I am trying to batch convert a collection of black symbols in .PNG (32bit RGB) images.
I select Batch Processing and add the Replace Color Transformations option.
I select the original color and the replacement color and click Go.
The images process, but the replacement color is pixelated - not smooth.
What am I doing wrong?
JPeni
Batch Replace Color Produces Pixelated Colors
Moderators: XnTriq, helmut, xnview
-
- Posts: 8
- Joined: Fri Apr 11, 2008 10:16 pm
- Location: Uniondale, NY, USA
-
- Posts: 291
- Joined: Sun Jun 11, 2006 2:43 pm
Re: Batch Replace Color Produces Pixelated Colors
Please upload the original Corpus Delicti in PNG format. Let me guess that it has more than 1 black colour?jpeni wrote:I am trying to batch convert a collection of black symbols in .PNG (32bit RGB) images.
What am I doing wrong?
There is indeed no WinZIP under my rock.
-
- XnThusiast
- Posts: 4110
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Batch Replace Color Produces Pixelated Colors
DOS386's explanation is probably correct...
If the intention is to batch convert 32bit RGB images of symbols to pure black symbols, it might be logical to batch convert the images to 1-bit colour depth using Transformations > Convert > Convert to Binary.
That does assume that there is no other colour in the source images which needs to be preserved, otherwise it would be an interesting challenge... Maybe using Levels?? Or possibly simply by reducing the number of colours in the PNG??
If the intention is to batch convert 32bit RGB images of symbols to pure black symbols, it might be logical to batch convert the images to 1-bit colour depth using Transformations > Convert > Convert to Binary.
That does assume that there is no other colour in the source images which needs to be preserved, otherwise it would be an interesting challenge... Maybe using Levels?? Or possibly simply by reducing the number of colours in the PNG??
-
- Posts: 8
- Joined: Fri Apr 11, 2008 10:16 pm
- Location: Uniondale, NY, USA
Re: Batch Replace Color Produces Pixelated Colors
I checked the original RGB 32-bit PNG image - the color is pure black - Value: 0,0,0. The image contains only Black and White.
I converted the PNG image to Binary (No dither) with XnView and reprocessed to Replace Black (0,0,0) with Red (255, 0, 0),
but the resulting Replaced Color symbol is still Black - the Red did not appear.
JPeni
I converted the PNG image to Binary (No dither) with XnView and reprocessed to Replace Black (0,0,0) with Red (255, 0, 0),
but the resulting Replaced Color symbol is still Black - the Red did not appear.
JPeni
-
- XnThusiast
- Posts: 4110
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Batch Replace Color Produces Pixelated Colors
If the image is converted to binary it can't contain anything except black and white. I'm sorry, I didn't realise you wanted to replace the black symbol with a red symbol, although that is in fact clear in your original post.
Can you post the original image, or a representative image, either as an attachment or as a link to a file hosting service, as DOS386 suggested?
Edit:
I have done a quick test with a simple image I created and with 24-bit depth black was replaced by red successfully, but when the same image was converted to 32-bit in XnView the histogram of the resultant 'red' image had some additional colour (which showed in the image as a band rather than pixelation).
If you can post a test image it should be possible to reproduce any bug if there is one for 32-bit depth images.
Can you post the original image, or a representative image, either as an attachment or as a link to a file hosting service, as DOS386 suggested?
Edit:
I have done a quick test with a simple image I created and with 24-bit depth black was replaced by red successfully, but when the same image was converted to 32-bit in XnView the histogram of the resultant 'red' image had some additional colour (which showed in the image as a band rather than pixelation).
If you can post a test image it should be possible to reproduce any bug if there is one for 32-bit depth images.
-
- Posts: 8
- Joined: Fri Apr 11, 2008 10:16 pm
- Location: Uniondale, NY, USA
-
- Moderator & Librarian
- Posts: 6363
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: Batch Replace Color Produces Pixelated Colors
If your goal is to convert these symbols from black to red without loosing the smooth edges, you're better off by just increasing the value of the red channel:jpeni wrote:I am trying to batch convert a collection of black symbols in .PNG (32bit RGB) images.
- View mode: Image » Adjust » Brightness/Contrast/Gamma/Balance... » Colour balance
- Batch processing: Map » Colour balance
-
- XnThusiast
- Posts: 4110
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Batch Replace Color Produces Pixelated Colors
The image obtained using Image » Adjust » Brightness/Contrast/Gamma/Balance... » Colour balance with Red=255, Green=0, Blue=0.
Excellent idea XnTrig, but the image still contains 143 unique colours. Is there a way to make a pure red image?
Edit:
The extra colours almost all occur on the edges of the symbol and suggest that the image has been anti-aliased at some point. Reducing the colour depth (using Levels with an extreme setting is one way) results in extra pixels becoming visible on the edges, which substantially degrade its appearance.
So at what point was the image anti-aliased? But as adjusting the colour balance seems to produce an acceptable image, and the anti-aliased image has a better appearance, are the extra colours a problem?
Finally, the original 'Replace colour' method does work correctly for 32-bit images with a single colour, and produces a pure red symbol when the image remains a PNG, but saving as a JPG seems to introduce additional colours and the possibility of banding or other artifacts.
You do not have the required permissions to view the files attached to this post.
-
- Moderator & Librarian
- Posts: 6363
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: Batch Replace Color Produces Pixelated Colors
You'll need XnViewMP for that:cday wrote:Excellent idea XnTrig, but the image still contains 143 unique colours. Is there a way to make a pure red image?
- Create an all red image with the same dimensions as p5fo5Lp.png (200×200 pixels) and name it blank.png.
- Invert p5fo5Lp.png (Image » Map » Negative) and save it as mask.png.
- Tools » Batch convert...
- Input » Add files...: blank.png
- Actions » Add action » Image » Add mask: mask.png (Use mask as alpha)
-
- Posts: 8
- Joined: Fri Apr 11, 2008 10:16 pm
- Location: Uniondale, NY, USA
Re: Batch Replace Color Produces Pixelated Colors
cday and XnTriq
Thanks for your help.
JPeni
Thanks for your help.
JPeni