circle's edges get cut off
Re: circle's edges get cut off
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: circle's edges get cut off
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.
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
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: circle's edges get cut off
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
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
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: circle's edges get cut off
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
convert img-before.png -channel rgba -bordercolor none -border 18 im-border18.png
Re: circle's edges get cut off
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.
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.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: circle's edges get cut off
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.
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: circle's edges get cut off
-border does not use the -channel setting!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: circle's edges get cut off
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
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!
Thank you again for all your help!