Hello,
For some reason -fuzz x -trim in not working on a png. The png was converted from a ps image. If I specify a very large fuzz value the image is blank, but keeps the same size.
fuzz and trim not working on a png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: fuzz and trim not working on a png
A bug fix was added in a later release of image that makes a -trim that completely trims the WHOLE image return a 'one pixel missed image' instead of a blank image.
As for you actual problem can you give a pointer to a small example image, and the exact command you are trying. Also did you use percent with fuzz or not?
Without a percent symbol the -fuzz value is compiletime Q level dependant.
As for you actual problem can you give a pointer to a small example image, and the exact command you are trying. Also did you use percent with fuzz or not?
Without a percent symbol the -fuzz value is compiletime Q level dependant.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: fuzz and trim not working on a png
The original ps, the first png, and the second png. edit: links to images removed
Commands:
The initial ps has a thin black border which the first -trim removes. When:
did not work I thought maybe I have to convert -trim ps to png to remove the black border and and convert-trim again to remove the whitespace. I also added the +repage thinking the postscript pagesize might be part of the issue. Ideally I wanted one command to do all the work so I ended up using -shave, which I did not want to do.
Commands:
Code: Select all
convert -colorspace RGB -density 288 -trim -filter box -support 1.5 -resize 40% -depth 8 -colors 256 +repage 00Z_EFINE_W3_042H.ps test.png
convert -fuzz 50% -trim -depth 8 -colors 256 test.png test2.png
Code: Select all
convert -colorspace RGB -density 288 -trim -filter box -support 1.5 -resize 40% -trim -depth 8 -colors 256 +repage 00Z_EFINE_W3_042H.ps test.png
Last edited by brendan on 2007-09-26T05:14:17-07:00, edited 1 time in total.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: fuzz and trim not working on a png
Well I am not surprised it did not work.
You are not reading the image in BEFORE operating on it.
IM has a hard time figuring out the exact order of operations when you do that.
Gad... huge images Arrgg, I asked for small images
First test
No problems. A little fuzzy but that is what you get with a box filter and a larger 'blur support' t.png I generated and your given test.png matched fine.
Ok but trim fails. BUT looking at the trimmed image WITHOUT resizing shows
that there is a VERY thin line surrounding the converted PS image!!!!
You need to do a more complex trim...
test trim (output to display)
Now that trims the image, removes the bounding box, then trims again, fully triming down to the image proper.
Final command...
The "png8:" taks care of the -depth and -colors requirements as that is the defination for a png8 image (like GIF but using PNG)
You are not reading the image in BEFORE operating on it.
IM has a hard time figuring out the exact order of operations when you do that.
Gad... huge images Arrgg, I asked for small images
First test
Code: Select all
convert -colorspace RGB -density 288 00Z_EFINE_W3_042H.ps -trim +repage -filter box -support 1.5 -resize 40% t.png
Ok but trim fails. BUT looking at the trimmed image WITHOUT resizing shows
that there is a VERY thin line surrounding the converted PS image!!!!
You need to do a more complex trim...
test trim (output to display)
Code: Select all
convert -colorspace RGB -density 288 00Z_EFINE_W3_042H.ps -trim -shave 2x2 -trim +repage x:
Final command...
Code: Select all
convert -colorspace RGB -density 288 00Z_EFINE_W3_042H.ps -trim -shave 2x2 -trim +repage -filter box -support 1.5 -resize 40% png8:test.png
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: fuzz and trim not working on a png
Anthony,
Many thanks. I had not used that type of syntax before(obviously). Sorry about the large images, but I am not the person generating the ps images, so I had no way to exactly duplicate the problem. All ps images I ever generate myself(mostly from Matlab) never have this problem. These images are given to me as ps converted from NCAR graphics cgm.
Thanks again.
Many thanks. I had not used that type of syntax before(obviously). Sorry about the large images, but I am not the person generating the ps images, so I had no way to exactly duplicate the problem. All ps images I ever generate myself(mostly from Matlab) never have this problem. These images are given to me as ps converted from NCAR graphics cgm.
Thanks again.
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: fuzz and trim not working on a png
Try specifying -bordercolor before -border.
Pete
Pete
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: fuzz and trim not working on a png
There was no use of -border in this problem. this was trimming broders, not adding borders.el_supremo wrote:Try specifying -bordercolor before -border.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: fuzz and trim not working on a png
There was when I first started typing my reply to the message. When I sent my response, the message I was replying to had disappeared and changed to "Never mind". Curious.There was no use of -border in this problem.
Pete