Hi,
This is my first post, please be kind
I'm experimenting with the imagemagick convert and mogrify commands. I have a lot of png images that I would like to:
set "black" to being transparent
crop the image so that it is 60x108+124+40
and then resize to 25% of the original size.
I've tried the command: mogrify *.png -alpha set -resize 25% -transparent black -crop 60x108+124+40
but other than change the image size from 26.8 kb to 17.1 kb, it doesn't seem to do anything.
Even when I re-order the commands into the sequence I'd like them carried out:
mogrify *.png -alpha set -transparent black -crop 60x108+124+40 -resize 25%
- nothing seems to happen.
Can anyone help?
Many thanks!
Best wishes
Paul
cropping, resizing and making images transparent
Re: cropping, resizing and making images transparent
Try this:
You might want to use a small amount of Fuzz and do not forget the original will be overwritten!
If it does not work can you post a sample image ?
Code: Select all
mogrify -fuzz 1% -transparent black -crop 60x108+124+40 -resize 25% *.png
If it does not work can you post a sample image ?
Re: cropping, resizing and making images transparent
Hi,
Looks great! When I open up File Browser, or Image Viewer, the image has been cropped as planned. I can't really tell if the black + fuzz has been made transparent. When I open up gimp to have a look, I get a message saying that the "PNG file specifies an offset that causes the layer to be positioned outside the image." Since the original image is 320 x 240 pixels (and yes, I did back up all the originals!), I am a bit mystified at this...
Thanks!
Paul
Looks great! When I open up File Browser, or Image Viewer, the image has been cropped as planned. I can't really tell if the black + fuzz has been made transparent. When I open up gimp to have a look, I get a message saying that the "PNG file specifies an offset that causes the layer to be positioned outside the image." Since the original image is 320 x 240 pixels (and yes, I did back up all the originals!), I am a bit mystified at this...
Thanks!
Paul
Re: cropping, resizing and making images transparent
Add a +repage
Code: Select all
mogrify -fuzz 1% -transparent black -crop 60x108+124+40 -resize 25% +repage *.png
Re: cropping, resizing and making images transparent
My tests opened OK in Gimp but the image was not on the background.
http://www.imagemagick.org/script/comma ... ptions.php
All the options are listed here:Use +repage to completely remove/reset the virtual canvas meta-data from the images.
http://www.imagemagick.org/script/comma ... ptions.php
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: cropping, resizing and making images transparent
perhaps the input png files already have a virtual canvas. so try putting another +repage right after mogrify to remove it from the input image before the rest of the processing and keep the one after the crop at the end to remove the virtual canvas left by the crop. I don't know if this will help, but it is easy to try.
also what version of IM are you using? PNG processing has been under continual change and improvement over the last number of releases. So you might try upgrading to the very latest version of IM
Good reading for new users is at:
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/Usage/reference.html
also what version of IM are you using? PNG processing has been under continual change and improvement over the last number of releases. So you might try upgrading to the very latest version of IM
Good reading for new users is at:
http://www.imagemagick.org/Usage/
http://www.imagemagick.org/Usage/reference.html
Re: cropping, resizing and making images transparent
It worked beautifully, many thanks!Bonzo wrote:Add a +repage
Code: Select all
mogrify -fuzz 1% -transparent black -crop 60x108+124+40 -resize 25% +repage *.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: cropping, resizing and making images transparent
Add a +repage afetr the -crop before the resize.DrPL wrote:I've tried the command: mogrify *.png -alpha set -resize 25% -transparent black -crop 60x108+124+40
but other than change the image size from 26.8 kb to 17.1 kb, it doesn't seem to do anything.
Even when I re-order the commands into the sequence I'd like them carried out:
mogrify *.png -alpha set -transparent black -crop 60x108+124+40 -resize 25%
- nothing seems to happen.
Also out the images at the end (for mogrify)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/