converting image to multiple a4's with glue edge ?

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

converting image to multiple a4's with glue edge ?

Post by Rye »

So. I'm currently trying to print out a huge picture over multiple images and then glue them together.

There already exists software for such task, such as PosteRazor and such.

However they all have one huge flaw:

They require using a Scissor and have sometimes inconsistencies applying the glue line

if a image like this:

Image

could be turned into multiple A4's with glue line like this:

Image
(orange is the glue line

i'd be totally satisifed, however I think short of imgmagick I cannot imagine this to work.

So the rundown is:
- Take any image
- cut it to multiple A4 images while adding ~2cm of empty glue line like pictured above
(Optimal would be if it took every image given to it and automagically cut and slice it to the perfect amount of required A4's.
(In order to keep 100% image size)
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: converting image to multiple a4's with glue edge ?

Post by fmw42 »

I am confused. Why do you want to cut them into separate A4 size images and then add the glue (padding) and then put them back into one big image? Do I misunderstand?

Don't you just want to cut the big image into separate A4 size images? If separate images, then why the padding around them?

If you want an image like what you show with the red lines, do you want the result to be larger than the original due to the glue (padding) or do you just want to put lines into the original to show where the A4 pieces come together so that the result is still the same size?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting image to multiple a4's with glue edge ?

Post by snibgo »

Another possibility: Rye wants the resulting pages to have a small overlap, with the image continuing into the overlap, so the pages can be pasted to a wall with a slight overlap and it doesn't matter which pages go on top.
snibgo's IM pages: im.snibgo.com
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

snibgo wrote:Another possibility: Rye wants the resulting pages to have a small overlap, with the image continuing into the overlap, so the pages can be pasted to a wall with a slight overlap and it doesn't matter which pages go on top.
Exactly !

I guess for snipping the images this might work ?

convert -crop 64x64 +repage test.tif test%02d.tif

( is there a way to make the values here auto-adjusted by the valuesthe image has ?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: converting image to multiple a4's with glue edge ?

Post by fmw42 »

Code: Select all

convert -crop 64x64 +repage test.tif test%02d.tif 
This kind of crop will have no overlap. You can use percentages rather than pixels. see http://www.imagemagick.org/Usage/crop/#crop and all that follows.

For overlap see http://www.imagemagick.org/Usage/crop/#crop_equal

see also http://www.fmwconcepts.com/imagemagick/ ... grid_lines

see also http://www.fmwconcepts.com/imagemagick/ ... /index.php
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting image to multiple a4's with glue edge ?

Post by snibgo »

A script could be written that would calculate the cropping parameters for each output image, according to the input size, desired amount of overlap, and desired number of tiles horizontally and vertically.
snibgo's IM pages: im.snibgo.com
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

Would this script require extra functions not included in IMGMagick ?

If not... what functions should be used ?
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting image to multiple a4's with glue edge ?

Post by snibgo »

I suggest you experiment with the cropping-with-overlap from http://www.imagemagick.org/Usage/crop/#crop_equal . Decide if that gives you what you want. If it doesn't, decide what else you need.
snibgo's IM pages: im.snibgo.com
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

ok, that overlap seems to be what I'm looking for.

Is it possible to afterwards replace the "underlap" (of the right side images) with a white space ?

If so, what command would I have to use if I wanted to have 20x20 pixel like this ?

----------------
| SPACE |
| P ----------|
| A| |
| C| PIC |
| E | |
|--------------|
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

Ok, cutting with offset works fine.

Now. How can I apply a white overlay over each picture (glue space) of 55 pixels on the right side and bottom side of each picture ?

Like so:

Image
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting image to multiple a4's with glue edge ?

Post by snibgo »

You can use gravity and splice, eg

Code: Select all

convert -size 100x100 xc: -gravity southeast -background Black -splice 55x55+0+0 b.png
Or gravity and extent, eg:

Code: Select all

convert -size 100x100 xc: -gravity northwest -background Black -extent 155x155 b.png
snibgo's IM pages: im.snibgo.com
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

I guess I wasn't clear...

This command:

convert d-0.gif -gravity southeast -background Black -splice 55x55+0+0 d-a0.gif

will ADD a border of 55x55 on the right and down side.

So the image goes from 710x901 to 765x956

I want to add the border while OVERWRITING existing image parts (!)
so the size shall stay 710x901 with the border added.
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: converting image to multiple a4's with glue edge ?

Post by snibgo »

You can chop it before the splice:

Code: Select all

convert -size 100x100 xc: -gravity southeast -background Black -chop 55x55+0+0 -splice 55x55+0+0 b.png
snibgo's IM pages: im.snibgo.com
Rye
Posts: 158
Joined: 2013-02-25T10:43:05-07:00
Authentication code: 6789

Re: converting image to multiple a4's with glue edge ?

Post by Rye »

Perfct ! :)

So, this is now the finished script to slice a image (+add glue borders) to each image:

Code: Select all

@echo off
SET /P width=Please enter numer of tiles (WIDE):
SET /P height=Please enter number of tiles (HEIGHT):

convert *.* -crop %width%x%height%+55+55@  +repage  +adjoin  %d.gif
for %%x in (*gif) do convert %%x -gravity southeast -background White -chop 55x55+0+0 -splice 55x55+0+0 %%x
Thread can be closed
Version: ImageMagick-7.0.7-28-Q16-x64-static http://www.imagemagick.org
Copyright: Copyright (C) 1999-2018 ImageMagick Studio LLC
Post Reply