Need to split image to make 2 separate images from one
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Need to split image to make 2 separate images from one
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.
Thanks, Ya'll are awesome on here...so helpful.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
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
also what is your IM version and platform
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
Here is the first image that needs to be split
http://davidfavor.com/web/images/archiv ... banana.jpg
Thanks..
http://davidfavor.com/web/images/archiv ... banana.jpg
Thanks..
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
Please explain or draw lines on your photo to show how you want it split.
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
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
Thanks
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
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
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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Need to split image to make 2 separate images from one
I would mask out the ground, as you say it is irrelevent. Perhaps make it a separate 'split'.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
With the ground removed you now have two shapes, that can be segmented into two seperate images.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
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?
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
...I got what I wanted by changing the command to this...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?
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!
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
This command does not make sense to me. Especially the \>.convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \> -compose over -background none banana_leftp.png
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?
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
Not sure how to check my version.fmw42 wrote:This command does not make sense to me. Especially the \>.convert banana.jpg \( banana_mask.gif -negate \) -alpha off -compose copy_opacity -composite \> -compose over -background none banana_leftp.png
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?
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".
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
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
convert -version
also
you can check what delegates you have installed by
convert -list configure
and look at the line starting with DELEGATES
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
DELEGATES bzlib fftw fontconfig freetype gs gvc jbig jpeg jng jp2 lcms lqr mpeg openexr png rsvg tiff x11 xml wmf zlibfmw42 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
That's what I got to work with
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Need to split image to make 2 separate images from one
what about your IM version, Qlevel and platform
-
- Posts: 19
- Joined: 2011-01-10T12:25:14-07:00
- Authentication code: 8675308
Re: Need to split image to make 2 separate images from one
Version: ImageMagick 6.6.6-3 2011-01-04 Q16fmw42 wrote:what about your IM version, Qlevel and platform
Not sure what you mean by platform. Are you talking about the processor?
Still learning computer language.