Crash with -keepcspace

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

Moderators: XnTriq, helmut, xnview

Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Crash with -keepcspace

Post by Wae666 »

Command: "nconvert.exe -c 2 -overwrite -out jpeg -o ResultFile.jpeg -dpi 100 -keepcspace CMYK_31080x17275.JPG"

File:
CMYK 8-bit
31080x17275 px
DPI 200
Size 103 MB

OS Windows 10 64-bit

Don`t understand... Why does the nconvert.exe crash with this command?

If I use the same file with a lower resolution, it works well.

File that crashed:
https://www.dropbox.com/s/pusnyi8vwxgb4 ... 5.JPG?dl=0

File that works well:
https://www.dropbox.com/s/r4kshqu1tu4gj ... 5.JPG?dl=0
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: nConvert crash with -keepcspace

Post by cday »

Wae666 wrote: Sat Feb 11, 2023 2:31 pm

Code: Select all

"nconvert.exe -c 2 -overwrite -out jpeg -o ResultFile.jpeg -dpi 100 -keepcspace CMYK_31080x17275.JPG"
I don`t understand... Why does the nconvert.exe crash with this command?
I am not sure, but two comments on your code which may, or may not, have some relevance:

1. The quality of JPEG images is normally set using the -q option:

Code: Select all

 -q value          : JPEG/FPX/WIC/PDF/JPEG2K/WebP quality (default : 85)
I haven't seen -c used before, although it is mentioned in the help file but with a possible value of 8:

Code: Select all

-c value          : Compression number
              default : 0 (uncompressed)
              PDF    : 1 (Fax), 2 (Rle), 3 (LZW), 4(ZIP), 5 (JPEG)
              TIFF   : 1 (Rle), 2 (LZW), 3 (LZW+Prediction)
                       4 (ZLIB)
                       5 (CCITT G3), 6 (CCITT G3-2D), 7 (CCITT G4) only B/W
                       8 (JPEG) only 24/32 bits

2. The -dpi option is used to set the resolution at which a PDF (for example) file is rasterised when opened using Ghostscript, I have never tested whether it can also be used to change the DPI of an image although the help file seems to indicate that:

Code: Select all

-dpi res_dpi      : Set the resolution in DPI
Support for NConvert is usually fairly limited, so generally best to back up as far as possible and then test to see what works!
Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Re: Crash with -keepcspace

Post by Wae666 »

Simplified the command to:

"nconvert.exe -overwrite -out jpeg -o ResultFile.jpeg -keepcspace CMYK_31080x17275.JPG"

Unfortunately, using (or not using) flags "-c" and "-dpi" has no effect on crashes.

Only "-keepcspace", CMYK color space and file resolution are affected.

There are no problems with RGB.
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

Are you by any chance using NConvert 32-bits?

If so, given the large pixel dimensions of your image and your comment that a lower resolution file converts correctly, you could test using the NConvert 64-bit version, in case the issue is the 32-bit software addressable memory limit.
Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Re: Crash with -keepcspace

Post by Wae666 »

I am using the 64-bit version.

Also tried several versions of nconvert :
v6.56
v7.136

The result is the same

It seems to me that there is some limitation in the number of pixels for CMYK. About 2^29 px. But I don't know where to find information about it.

I experimented with files of this resolution:
[-] 38796*13911 = 539 691 156
[-] 31085*17279 = 537 117 715
[-] 38699*13876 = 536 987 324
[-] 31080*17276 = 536 938 080
[-] 38697*13875 = 536 920 875
[-] 31079*17276 = 536 920 804
[-] 26032*20625 = 536 910 000
[+] 40752*13175 = 536 907 600
[-] 31080*17275 = 536 907 000
[+] 38696*13875 = 536 907 000
[+] 43829*12250 = 536 905 250
[+] 32788*16375 = 536 903 500
[+] 13216*40625 = 536 900 000
[+] 31079*17275 = 536 889 725
[+] 31078*17275 = 536 872 450
[+] 31077*17274 = 536 824 098

[+] - success
[-] - crash
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

Wae666 wrote: Sat Feb 11, 2023 4:04 pm It seems to me that there is some limitation in the number of pixels for CMYK. About 2^29 px. But I don't know where to find information about it.
Pierre?
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

Both downloads open in XnView MP 64-bit but the crash file takes noticeably longer, what terminal output do you get running your NConvert code?

CMYK_32788x16375 [Crash] Properties.png
You do not have the required permissions to view the files attached to this post.
Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Re: Crash with -keepcspace

Post by Wae666 »

I'm getting an allert from Windows.

"The program "nconvert.exe" is not working.
A problem has caused the program to stop working. Windows will close the program."
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

Do you get that alert quickly or after a reasonable delay -- could Windows possibly be assuming that as no output has been produced yet that NConvert has crashed?

I don't know how you could determine that, but opening the image in XnView MP 64-bit was very slow: do you have a faster computer, or could someone maybe test on a powerful computer?
Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Re: Crash with -keepcspace

Post by Wae666 »

After entering a command in PowerShell, there is a delay of 1 minute. After that it crashes.

Latency is the same on my local PC as it is on the production server.

On the server there is a notification from Windows, on the local PC - no.
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

And the approximate times for the smaller images that do convert, as the file size is increased do they increase to near 1 minute? If so, that would seem to suggest an arbitrary Windows time limit before conversion is assumed to have failed, wouldn't it?
Wae666
Posts: 6
Joined: Sat Feb 11, 2023 2:13 pm

Re: Crash with -keepcspace

Post by Wae666 »

Most often I convert large files up to 45000x45000, it takes more than a minute and the process does not crash. But those files are RGB, so there is no problem with them.

I don't think the operating system limits nconvert's run time.
cday
XnThusiast
Posts: 4178
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Crash with -keepcspace

Post by cday »

I give up... :wink:

Pierre ?
klv_guest
Posts: 1
Joined: Sat Feb 11, 2023 7:42 pm

Re: Crash with -keepcspace

Post by klv_guest »

I got "Segmentation fault" message when I'm trying to convert problem image @ Win 10.
Tried same command on Linux: it gave me "Segmentation fault (core dumped)"
Probably developers could debug it with gdb
User avatar
xnview
Author of XnView
Posts: 44883
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: Crash with -keepcspace

Post by xnview »

ok will be fixed
Pierre.