Page 1 of 2

Need to split image to make 2 separate images from one

Posted: 2011-02-16T08:11:06-07:00
by aLabelMaker
What's the best way to do this? the split would need to be done from a diagnol line, not vert or horiz based on how the image( two trees) is set up.

Thanks, Ya'll are awesome on here...so helpful.

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T11:52:23-07:00
by fmw42
Post a link to your image so that one can see what you need to do and explain where it needs to be split. Sound like you need to create a mask with two colors white and black and draw a triangle like polygon to fill one color and the rest be the other color. See -draw at http://www.imagemagick.org/Usage/draw/

also what is your IM version and platform

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T12:34:49-07:00
by aLabelMaker
Here is the first image that needs to be split

http://davidfavor.com/web/images/archiv ... banana.jpg

Thanks..

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T12:36:50-07:00
by fmw42
Please explain or draw lines on your photo to show how you want it split.

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T15:54:17-07:00
by aLabelMaker
i would simply like to have each tree in a separate image to later be manipulated. The bottom black (ground) portion is not too important on how it is split. I just need to be able to work with each tree separately.

Thanks

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T17:00:08-07:00
by fmw42
run these 3 commands:


convert -size 2800x1949 xc:black -fill white \
-draw "polygon 1532,0 1532,756 1440,824 1440,1949 2800,1949 2800,0" \
-alpha off banana_mask.gif

convert banana.jpg banana_mask.gif -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_right.jpg

convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_left.jpg

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-16T18:20:29-07:00
by anthony
aLabelMaker wrote:i would simply like to have each tree in a separate image to later be manipulated. The bottom black (ground) portion is not too important on how it is split. I just need to be able to work with each tree separately.

Thanks
I would mask out the ground, as you say it is irrelevent. Perhaps make it a separate 'split'.
With the ground removed you now have two shapes, that can be segmented into two seperate images.

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-17T08:11:34-07:00
by aLabelMaker
fmw42 wrote:run these 3 commands:


convert -size 2800x1949 xc:black -fill white \
-draw "polygon 1532,0 1532,756 1440,824 1440,1949 2800,1949 2800,0" \
-alpha off banana_mask.gif

convert banana.jpg banana_mask.gif -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_right.jpg

convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_left.jpg

The first command went good and produced black/white polygon image.
The next 2 did not yield the right output with the trees. Both trees are present in both of the next 2 commands?

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-17T09:27:09-07:00
by aLabelMaker
aLabelMaker wrote:
fmw42 wrote:run these 3 commands:


convert -size 2800x1949 xc:black -fill white \
-draw "polygon 1532,0 1532,756 1440,824 1440,1949 2800,1949 2800,0" \
-alpha off banana_mask.gif

convert banana.jpg banana_mask.gif -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_right.jpg

convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \
-compose over -background white -flatten banana_left.jpg

The first command went good and produced black/white polygon image.
The next 2 did not yield the right output with the trees. Both trees are present in both of the next 2 commands?
...I got what I wanted by changing the command to this...

convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \> -compose over -background none banana_leftp.png

I changed background to none, and took out the "-flatten" command and it worked.

Now planning to cut image so that only the tree's are shown in pic.

Thanks!

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-17T11:14:21-07:00
by fmw42
convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \> -compose over -background none banana_leftp.png
This command does not make sense to me. Especially the \>.

Note that the \ at the end of the lines is unix and means command is continued to the next line.

What version and platform of IM are you using?

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-17T17:02:51-07:00
by aLabelMaker
fmw42 wrote:
convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \> -compose over -background none banana_leftp.png
This command does not make sense to me. Especially the \>.

Note that the \ at the end of the lines is unix and means command is continued to the next line.
Oh, I didn't know that... This would be very helpful while i was finding code online as i have been adding the whole including the \>'s
No wonder I've been having so much trouble.
What version and platform of IM are you using?
Not sure how to check my version.

hmm, I believe I'm using the most updated version as I downloaded it only a few months ago with the help of a friend. Using on a mac book pro working through the bash shell..

It was strange because I did get an error message, but the image still appeared on mys desktop after I hit enter.

Lots of trial and "error".

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-17T18:43:41-07:00
by fmw42
You can check your version by:

convert -version


also

you can check what delegates you have installed by

convert -list configure

and look at the line starting with DELEGATES

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-18T08:43:26-07:00
by aLabelMaker
fmw42 wrote:You can check your version by:

convert -version
I am using version 6.6.6-3

also

you can check what delegates you have installed by

convert -list configure

and look at the line starting with DELEGATES
DELEGATES bzlib fftw fontconfig freetype gs gvc jbig jpeg jng jp2 lcms lqr mpeg openexr png rsvg tiff x11 xml wmf zlib

That's what I got to work with :)

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-18T11:07:45-07:00
by fmw42
what about your IM version, Qlevel and platform

Re: Need to split image to make 2 separate images from one

Posted: 2011-02-22T17:09:16-07:00
by aLabelMaker
fmw42 wrote:what about your IM version, Qlevel and platform
Version: ImageMagick 6.6.6-3 2011-01-04 Q16

Not sure what you mean by platform. Are you talking about the processor?
Still learning computer language.