Page 2 of 2
Re: circle's edges get cut off
Posted: 2009-06-25T17:11:06-07:00
by rs13
Ok,we found what our problem is and it is actually totally unrelated to the png format that we thought of. It turns out that if we do 'canvas resize' in photoshop and increase the canvas dimensions by 20px in both width and height, the image renders correctly.
To that end, I looked how to resize the image canvas and not the image itself but I cannot seem to figure out. Can you please shed some light onto this by way of example?
Again, thank you guys for all your help.
Re: circle's edges get cut off
Posted: 2009-06-25T17:15:31-07:00
by fmw42
if you want to remove the virtual canvas add +repage after you read your image. If you want to modify the virtual canvas see -repage
http://www.imagemagick.org/script/comma ... php#repage
http://www.imagemagick.org/Usage/anim_basics/#gif_anim
Anthony will be much better at helping you with this than I.
Re: circle's edges get cut off
Posted: 2009-06-25T21:08:02-07:00
by rs13
I studied -repage command but it seems I have to know the dimensions of the image file to begin with.
Since the images are of all sizes and I do not know the image dimensions.
All I need to basically do is to increase the width and height of the canvas by 20px (without specifying what the original canvas size is) and then set the offset to 10x10px or re-center the image again so that it is centered in the new enlarged canvas.
Re: circle's edges get cut off
Posted: 2009-06-25T21:43:15-07:00
by fmw42
try reading this and see if any of these work:
http://www.imagemagick.org/Usage/basics/#page
But I am not sure if you want to change the virtual canvas or just change the actual image. If you want to add a border of some color around an image, say 10 pixels, then you can just do
convert image -gravity center -bordercolor somecolor -border 10 result
Re: circle's edges get cut off
Posted: 2009-07-02T08:58:50-07:00
by rs13
Still trying to get the border right on the png file.
When I run:
exec('convert ' . $strFilePath . ' -alpha off -bordercolor none -border 18 -alpha on ' . $strFilePath . ".png");
everything works except that everything within the transparent border of 18px has now switched from transparent to having white background.
My file before running the command is at
http://209.20.87.13/img-before.png
and after it is at:
http://209.20.87.13/img-after.png
It seems as if during the border command, the transparency gets altered. Please help.
Re: circle's edges get cut off
Posted: 2009-07-02T09:21:44-07:00
by fmw42
This works for me (you have to add a border to both the image and the overlay alpha channel):
convert img-before.png -channel rgba -bordercolor none -border 18 im-border18.png
Re: circle's edges get cut off
Posted: 2009-07-02T10:44:39-07:00
by rs13
Hmm, I tried to run only:
exec('convert ' . $strFilePath . ' -channel rgba -bordercolor none -border 18 ' . $strFilePath . ".png");
as per your recommendation but the resulting file gets somehow corrupted -- I cannot open it with anything. It is located at
https://209.20.87.13/img-corrupt.png.
I mean it loads in the browser but as soon as I try to open it in photoshop or some other image viewer it fails to open. I also noticed that when you view it through the web browser the bottom part of the circle gets chopped off.
Re: circle's edges get cut off
Posted: 2009-07-02T14:50:43-07:00
by fmw42
Here is the file I created with that command
convert img-before.png -channel rgba -bordercolor none -border 18 img-border18.png
http://www.fmwconcepts.com/misc_tests/img-border18.png
It looks perfectly fine to me. Try downloading it and see if you have any trouble.
My guess is that you have an old version of IM and need to upgrade. I am using 6.5.4-2 Q16 Mac OSX Tiger.
Re: circle's edges get cut off
Posted: 2009-07-02T21:12:00-07:00
by anthony
-border does not use the -channel setting!
Re: circle's edges get cut off
Posted: 2009-07-02T21:56:43-07:00
by fmw42
anthony wrote:-border does not use the -channel setting!
Thanks. I see that I get the same result with:
convert img-before.png -bordercolor none -border 18 img-border18b.png
Re: circle's edges get cut off
Posted: 2009-07-05T01:13:22-07:00
by rs13
Thanks guys! I guess I have to update my ImageMagick as I do not have the latest version and perhaps that is why my png gets corrupted running that command. I will confirm as soon as I check this.
Thank you again for all your help!