Split image to make 2 separate images from one (vert)

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
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Split image to make 2 separate images from one (vert)

Post by myspacee »

Hello, Windows suer here,
read about splitting images and have a question.

I've a system that load a lot of pages. Sometimes one page is langer than others.

I need to detect weight, and when i find that page is langer than x, cut in half vertically.
One image for left part and one for right part.

post original large image : http://static.repubblica.it/laprovincia ... /large.jpg
and its preview :
Image

thank you for any help,

m.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Split image to make 2 separate images from one (vert)

Post by anthony »

for 'if image is large than X' part you will need to use a script (DOS, PHP, Perl, Shell, etc) to make the test.

If X is also your tile crop size, then you can 'just do it' as an image smaller than that size that is tile cropped will not be modified. That is you get one tile of the original image.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: Split image to make 2 separate images from one (vert)

Post by myspacee »

thank you for reply,
as windows user think about dos batch.

Find a lot of post related to method to obtain information about an image (weight and height)

to start in right direction can you suggest me best method ?
(need only weight and height info to put in easy way in variable)

thank you,

m.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: Split image to make 2 separate images from one (vert)

Post by myspacee »

ok obtain info and left page,

Code: Select all

identify -format "%%w" test.jpg > w.txt
identify -format "%%h" test.jpg > h.txt

set /p Weight=< w.txt
set /p height=< h.txt
set /A half_Weight=%Weight%/2
set /A half_height=%height%/2

echo %Weight% = %half_Weight% 
echo %height% = %half_height% 

convert test.jpg -repage %half_Weight%x%height% sx.gif
anyone can help me to obtain right page ?

thank you,

m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Split image to make 2 separate images from one (vert)

Post by fmw42 »

try this:


convert small.jpg -crop 50x100% +repage small_%d.jpg


see http://www.imagemagick.org/Usage/crop/#crop and all the crop sections that follow.
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: Split image to make 2 separate images from one (vert)

Post by myspacee »

ok, working to slice image in 2 identical part. (same size)

is there anyway to place 'cutter' where i want ?

Image

i've all info i need (weight and height), or i need other information ?

I want to be able to put 'cutter' where i need...

thank you,

m.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Split image to make 2 separate images from one (vert)

Post by fmw42 »

Did you read the page I referenced? All you need to do is specify a different width in percent or pixels (for the left side).


convert small.jpg -crop 63x100% +repage small_%d.jpg

or

convert small.jpg -crop 200x240 +repage small_%d.jpg
myspacee
Posts: 153
Joined: 2007-06-14T02:09:35-07:00

Re: Split image to make 2 separate images from one (vert)

Post by myspacee »

thank you for reply,
read documentation but don't understand how use (i'm less smart than i think)

thank you again for support,

m.
Post Reply