Hello everybody
We need to convert big scanned plans. They are all TIF and scanned in black & white.
However, we need them with transparent background and Nconvert would be ideal to run from a command line to set the color white to transparent.
Its a piece of cake with XnConvert (see screenshot), but despite searching and trying, I wasn't able to get the same result as in XnConvert with NConvert: Simply replace with (255 255 255) with transparent color.
Does anybody know how to do this?
Also, I can't get the Reference Manual linked on https://www.xnview.com/wiki/index.php?t ... User_Guide , the file seems to be corrupted.
Does anybody have it?
$any thanks for your help in advance,
Micharius
(non-Englisch speaker...)
Transparency for
Moderators: XnTriq, helmut, xnview
-
- Posts: 2
- Joined: Mon Sep 16, 2024 8:21 pm
Transparency for
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4134
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Transparency for
I think it would be helpful if you could:
o Create a small test file with similar properties to the files that you wish to convert, the same bit depth (1, 8, 24 or 32 bits) and compression option, etc., that converts in XnConvert but not using your NConvert code.
o Post the XnConvert output file;
o Post the NConvert code that you are using.
Maybe you could crop out a small area of one of your files, or you could, for example, create a suitable file using the XnView MP File > New image... and Image > Draw... options.
Note that I am not very knowledgeable about transparency, but defining the issue fully may assist Pierre, or maybe even someone else!
As you say, the link to the NConvert PDF guide is broken, but I don't think it contained any additional text to that in the HTML file.
o Create a small test file with similar properties to the files that you wish to convert, the same bit depth (1, 8, 24 or 32 bits) and compression option, etc., that converts in XnConvert but not using your NConvert code.
o Post the XnConvert output file;
o Post the NConvert code that you are using.
Maybe you could crop out a small area of one of your files, or you could, for example, create a suitable file using the XnView MP File > New image... and Image > Draw... options.
Note that I am not very knowledgeable about transparency, but defining the issue fully may assist Pierre, or maybe even someone else!
As you say, the link to the NConvert PDF guide is broken, but I don't think it contained any additional text to that in the HTML file.
-
- Posts: 2
- Joined: Mon Sep 16, 2024 8:21 pm
Re: Transparency for
Hello
Thanks for offering your help.
Attached is one of the scanned plans. I had to compress it, the raw file was too big.
What I tried with nconvert
This indeed gives me a file output.tif, but it's almos 31x the size of the original file, and without transparency.
Thanks for offering your help.
Attached is one of the scanned plans. I had to compress it, the raw file was too big.
What I tried with nconvert
Code: Select all
nconvert -transpcolor 255 255 255 -out tiff -o output.tif test_white_1.tif
** NCONVERT v7.192 (c) 1991-2024 Pierre-E Gougelet (Aug 26 2024/11:00:16) **
Version for Windows 7/8/10/11 x64 (All rights reserved)
** This is freeware software (for non-commercial use)
?==> 0
Conversion of test_white_1.tif into output.tif OK
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4134
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Transparency for
These are the properties of your attached test image:
Could you please post the properties of the original full-size image using XnView MP Image > Properties...
I am concerned that your smaller test image may have different properties.
You might be better making a crop of a small area of a full size image, and then ensuring that it is saved with identical properties to the original image.
You should also please ensure that your test image converts to transparent using XnConvert so that the test image is valid.
Note: I don't have much time today.
Could you please post the properties of the original full-size image using XnView MP Image > Properties...
I am concerned that your smaller test image may have different properties.
You might be better making a crop of a small area of a full size image, and then ensuring that it is saved with identical properties to the original image.
You should also please ensure that your test image converts to transparent using XnConvert so that the test image is valid.
Note: I don't have much time today.
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 1849
- Joined: Sat May 09, 2015 9:37 am
Re: Transparency for
you messed your BW file while editing/saving, fixed one:
you cannot have transparency in 1bit monochrome image, so you need to convert it into:
- indexed (PNG) OR
- 32bit (TIFF, PNG)
also check TIFF's compression settings to reduce file sizeyou cannot have transparency in 1bit monochrome image, so you need to convert it into:
- indexed (PNG) OR
- 32bit (TIFF, PNG)
You do not have the required permissions to view the files attached to this post.
-
- XnThusiast
- Posts: 4134
- Joined: Sun Apr 29, 2012 9:45 am
- Location: Cheltenham, U.K.
Re: Transparency for
Thank you user0, I said that I had limited knowledge of transparency, unfortunately very few members ever post on NConvert topics...
Black and White 1-bit TIFFs with CCITT G4 [Fax] compression would certainly be the best [readily available] way to archive those drawings, but if transparency is required for their use that can be expected to increase their file size. If there is a large collection of drawing, possibly they could only be converted to transparent images when used.
@Micharius:
If confidentiality is not an issue and an original file is not too large, maybe you could provide a download link to an example file to remove any uncertainty?
Black and White 1-bit TIFFs with CCITT G4 [Fax] compression would certainly be the best [readily available] way to archive those drawings, but if transparency is required for their use that can be expected to increase their file size. If there is a large collection of drawing, possibly they could only be converted to transparent images when used.
@Micharius:
If confidentiality is not an issue and an original file is not too large, maybe you could provide a download link to an example file to remove any uncertainty?
-
- Moderator & Librarian
- Posts: 6366
- Joined: Sun Sep 25, 2005 3:00 am
- Location: Ref Desk
Re: Transparency for
- Download and extract the sample provided by Micharius.
- Open test_white_1.tif in XnView Classic.
- Go to Image → Convert to Binary → Binary (No Dither).
- Go to Image → Convert to Colours… and select 8 colors without dithering.
- Go to Image → Edit Palette… and Enable transparency for white.
- Save the file as test_white_1.png.
Result: 4-bit indexed with a 16-color palette and alpha channel transparency (1'006'671 bytes) - Optimize test_white_1.png with PngOptimizer (lossless).
Result: 1-bit grayscale with transparency (722'184 bytes)
You do not have the required permissions to view the files attached to this post.