un probleme avec / problem with "-levels 1 213"

Discussions on NConvert - the command line tool for image conversion and manipulation

Moderators: XnTriq, xnview

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sat Jul 29, 2017 4:05 pm

bonjour (Englih(?) is at the end)
je cherche a récupérer de vieux scans qui sont un peu gris et de faible résolution.
Dans xnview ca marche plutot bien avec:

Code: Select all

nconvert -levels 0 213 -ratio -rtype lanczos -resize shortest 1920 

mais qund j'inclus cette commande dans un BAT (avec nconvert donc) j'ai des images qui sont éclaircies (grillées, beaucoup plus que lors du traitement manuel) sur environ le 1/4 supérieur, le reste étant inchangé.
J'ai essayé de séparer l'aclircissement du redimensionnement, de changer de format JPG> eclaircissement et BMP > JPG
rien n'y fait . EX (elles sont toutes comme ca !)
img_1920_RSD_003.jpg


il y a t il un moyen de contourner cela ?
d'autant plus frustrant que ca marche mannuellement :|

Hello;
trying to clean old scans, without real white and black
in xnconvert treatment and conversion work well
"export to nconvert" is:

Code: Select all

nconvert -levels 0 213 -ratio -rtype lanczos -resize shortest 1920 

when this line is used in a BAT file it makes the upper quarter of each image many more clear than specified, the 3/4 untouched

i have try to put

Code: Select all

-levels 0 213

at different pales, i try to convert in different formats, to make the conversion before resizing... NO WAY
Any way to make it work ? (It is fine doing it thru XNCONVERT )
Thanks

cday
XnThusiast
Posts: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: un probleme avec / problem with "-levels 1 213"

Postby cday » Sat Jul 29, 2017 5:03 pm

payaxnv wrote:quand j'inclus cette commande dans un BAT (avec nconvert donc) j'ai des images qui sont éclaircies (grillées, beaucoup plus que lors du traitement manuel) sur environ le 1/4 supérieur, le reste étant inchangé.

To be clear:

In XnConvert all images are converted correctly?

But in NConvert [tested in a batch file] all images, or only some images, are not converted correctly?

Could you upload an example file that doesn't convert correctly using NConvert, so that Pierre can possibly test it?

Edit:

The XnConvert Resize dialog has a setting for Enlarge/Reduce which I don't see in your code, or as an option in the NConvert help file, possibly not supported in NConvert??

I see there is the following option associated with the resize option, I don't know if it could be relevant, probably not??

Code: Select all

-resize fill w h    : Scale by filling the box wxh

Pierre?

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sat Jul 29, 2017 9:35 pm

thanks for your answer:
In XnConvert all images are converted correctly?
YES

But in NConvert [tested in a batch file] all images, or only some images, are not converted correctly?
NO... NONE

Could you upload an example file that doesn't convert correctly using NConvert, so that Pierre can possibly test it?
yes (ALL the images are mistreated (tested on #50 different one))

I have try before or within resizing: same wrong result :|

Code: Select all

 %nconvert_path%  -overwrite -out bmp -levels 1 213 -o img_1920_RSD_### *.jpg
 %nconvert_path%  -overwrite -out bmp  -dpi 72 -resize 1920 0 -ratio -rtype lanczos -subsampling 2 -o img_1920_RSD_### img_1920_RSD_*.bmp

or

Code: Select all

%nconvert_path% -levels 0 213 -ratio -rtype lanczos -resize shortest 1920 -out bmp -o img_1920_RSD_### *.jpg


original image (exemple)
Attachments
02a.jpg

User avatar
XnTriq
Moderator & Librarian
Posts: 5092
Joined: Sun Sep 25, 2005 3:00 am
Location: Ref Desk

Re: un probleme avec / problem with "-levels 1 213"

Postby XnTriq » Sun Jul 30, 2017 12:45 am

Could you please try the icc_ie (Ignore embedded ICC profile) option, payaxnv?

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sun Jul 30, 2017 8:10 am

no result (same result) with:

Code: Select all

%nconvert_path% -icc_ie -levels 0 213 -ratio -rtype lanczos -resize shortest 1920 -out bmp -o img_1920_RSD_### *.jpg

:bug: :|
I have tested in 2 steps: 1: just change levels then 2 resize...same bug
so it is in the "level" command
i try also level 1 123 instead of level 0 123 > same thing

All images have the same problem:
Attachments
xnconvert001.png

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sun Jul 30, 2017 8:25 am

PS
tested with another bunch of images from another sources > same result :bug:

cday
XnThusiast
Posts: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: un probleme avec / problem with "-levels 1 213"

Postby cday » Sun Jul 30, 2017 8:37 am

payaxnv wrote:PS
tested with another bunch of images from another sources > same result :bug:

I think testing with a single image that shows the problem (the JPEG you posted above?) and the minimum code that produces the problem (seems to be the levels operation?) is the best way to proceed...

[I'm afraid I don't have any time today, or othe ideas immediately... :( ]

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sun Jul 30, 2017 2:26 pm

some info:
tested with a total of #200 images from various sources > same result
i forgot to mention that during the bat, nconvert says "ok" to each operation

most interesting: tested with -autolevels :

Code: Select all

 rem 2 operations
 rem intermediate images are kept for debugging
 rem 1 works on levels
 %nconvert_path%  -icc_ie -overwrite -out bmp  -autolevels -o img_1920_RSD0_### *.jpg
rem 2 resize
 %nconvert_path%  -overwrite -out bmp -q 90  -dpi 72 -resize 1920 0 -ratio -rtype lanczos -subsampling 2 -o img_1920_RSD_### img_1920_RSD0_*.bmp
 

NOT the same errors
BUT mistreatment appears in large (double page) images

> seems to be insufficient buffer to work
if you agree, please contact the author of this wonderful tool

if i make a mistake, please correct me
thanks for helping

EDIT:
im not sure as before, next tests show errors also with -autolevels, about 2% of images:ex:
Attachments
img_1920_RSD0_002.jpg
after -autolevels (strong compression for publishing)
Cro (02).jpg
original

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Sun Jul 30, 2017 2:58 pm

another example:
Attachments
Cro (57).jpg
original
img_1920_RSD0_057.jpg
after -autolevels

cday
XnThusiast
Posts: 1561
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: un probleme avec / problem with "-levels 1 213"

Postby cday » Sun Jul 30, 2017 5:05 pm

I think you need to try to isolate the problem to one or two example files, and the simplest code required to reproduce the issue, so that it can be reproduced easily and investigated... :)

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Mon Jul 31, 2017 2:02 pm

the code is in the post above :D :
in fact only the first command is interesting, second one resize (properly) an already altered image

Code: Select all

 rem 2 operations
 rem intermediate images are kept for debugging
 rem 1 works on levels
 %nconvert_path%  -icc_ie -overwrite -out bmp  -autolevels -o img_1920_RSD0_### *.jpg
rem 2 resize
 %nconvert_path%  -overwrite -out bmp -q 90  -dpi 72 -resize 1920 0 -ratio -rtype lanczos -subsampling 2 -o img_1920_RSD_### img_1920_RSD0_*.bmp


the test images are in the 2 post before :D :D

you can change

Code: Select all

-autolevels
with

Code: Select all

 -levels 1 123
or

Code: Select all

-levels 0 123

to reproduce this problem :D :D :D

User avatar
xnview
Author of XnView
Posts: 28086
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: un probleme avec / problem with "-levels 1 213"

Postby xnview » Wed Aug 02, 2017 11:30 am

it's not really a bug, -autolevels work on all separate component, -autocontrast works closest as -levels

With your pictures, -autolevels doesn't work correctly
Pierre.

payaxnv
Posts: 17
Joined: Sat Jan 10, 2009 2:40 pm

Re: un probleme avec / problem with "-levels 1 213"

Postby payaxnv » Thu Aug 03, 2017 12:10 pm

OK i understand,
but it s not working fixed levels (should be apply to all images) as -levels 1 123
?


Return to “NConvert”

Who is online

Users browsing this forum: No registered users and 2 guests