When i try to convert tiff to jpeg I get exception

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

Moderators: XnTriq, helmut, xnview

punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

When i try to convert tiff to jpeg I get exception

Post by punith8626 »

Hello,

When i try to convert image from tiff to jpg I get below error message.
Here is the command that i have used.

Code: Select all

nconvert -out jpeg  -o C:\tiff\test.jpg C:\tiff\Release\test.tiff

Code: Select all

my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x49 0x49>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

But when i try open this with laserfiche it works fine.
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

I don't know, but you could try with this option included in your code:

Code: Select all

-ignore_errors    : Ignore errors
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

Still dint get solution
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

punith8626 wrote:Still didn't get solution
Can you upload the file?
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

Without converting file is it possible to check whether the file is corrupted or not?
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

punith8626 wrote:Without converting file is it possible to check whether the file is corrupted or not?
Another Windows software that is normally reasonably tolerant of errors also reports the file as being incorrectly formed...

However, XnView MP that is normally less tolerant of malformed files does open it, as does XnConvert.

Pierre or XnTriq may be able to comment further, but if you simply need a way of easily batch converting those TIFFs to JPEGs you could probably use XnConvert...

Edit:

If your file has more than one page, I have the impression there may be three pages, then only the first page seems to be opened by XnView MP and XnConvert.

I am also able to open that [first?] page using this code:

Code: Select all

nconvert -out jpeg test.tif 
Even though an error message is displayed.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

I need command line option like nconvert.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

I tried same tiff file with windows 7 nconvert and NCONVERT v6.95 and 7.1 32 bit and 64 bit

I got below exception
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x49 0x49>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
my_error_exit...<Not a JPEG file: starts with 0x00 0x7b>
Error: Don't know how to read this picture (test.tif)

When i try to convert same with Image magic I get below Exception.
convert.exe: Invalid TIFF directory; tags are not sorted in ascending order. `TI
FFReadDirectoryCheckOrder' @ warning/tiff.c/TIFFWarnings/768.
convert.exe: ASCII value for tag "Artist" contains null byte in value; value inc
orrectly truncated during reading due to implementation limitations. `TIFFFetchN
ormalTag' @ warning/tiff.c/TIFFWarnings/768.
convert.exe: Depreciated and troublesome old-style JPEG compression mode, please
convert to new-style JPEG compression and notify vendor of writing software. `O
JPEGSetupDecode' @ warning/tiff.c/TIFFWarnings/768.
convert.exe: Missing JPEG tables. `OJPEGReadHeaderInfoSecTablesQTable' @ error/t
iff.c/TIFFErrors/508.

May I know which version you are using?
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

punith8626 wrote:I tried same tiff file with windows 7 nconvert and NCONVERT v6.95 and 7.1 32 bit and 64 bit
...

May I know which version you are using?

Code: Select all

D:\Scripts\01 NConvert Scripts\zzzzzzz>NConvert -out jpeg *.tif
** NCONVERT v6.70 (c) 1991-2015 Pierre-E Gougelet (Feb 18 2015/16:43:07) **
        Version for Windows NT/9x/2000/Xp/Vista/7  (All rights reserved)
** This is freeware software (for non-commercial use)

my_error_exit...<Not a JPEG file: starts with 0x4a 0x46>
my_error_exit...<Not a JPEG file: starts with 0x4a 0x46>
my_error_exit...<Not a JPEG file: starts with 0x49 0x49>
  JPEG load : 1700 2200
Conversion of test.TIF into test.jpg OK

D:\Scripts\01 NConvert Scripts\zzzzzzz>Pause
Press any key to continue . . .
Tested with Windows 7 and NConvert 6.70 32-bit above, similar result with 7.00 64-bit...

Note that I normally test code in a batch file.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

Batch file means ?
Example ?
How do i download older versions?
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

punith8626 wrote:Batch file means ?
The code is placed in a file with a .bat extension.

One advantage is that multiple code lines can be placed in the same file and run consecutively when required, I also find it convenient when testing code, however it is sometimes necessary to modify code slightly.
punith8626 wrote: Example ?
The above command line was run in a text file with a .bat extension.
punith8626 wrote: How do I download older versions?
Old versions

However, if I get the same result with 6.70 and 7.00 I doubt if the version used is significant.
punith8626
Posts: 48
Joined: Thu Feb 02, 2017 11:22 am

Re: When i try to convert tiff to jpeg I get exception

Post by punith8626 »

cday wrote:
punith8626 wrote:Batch file means ?
The code is placed in a file with a .bat extension.

One advantage is that multiple code lines can be placed in the same file and run consecutively when required, I also find it convenient when testing code, however it is sometimes necessary to modify code slightly.
punith8626 wrote: Example ?
The above command line was run in a text file with a .bat extension.
punith8626 wrote: How do I download older versions?
Old versions

However, if I get the same result with 6.70 and 7.00 I doubt if the version used is significant.
did you try with manual commands ?
Is it possible to contact you via skype ? I need to talk to you regarding my queries related to nconvert ?
Could you please try same with 8.95 and 7.1 ?
there is no 6.70 in the above URL
Last edited by punith8626 on Thu Sep 14, 2017 3:01 pm, edited 1 time in total.
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

punith8626 wrote: Did you try with manual commands ?
I've long been a Windows user but never expected to use the command line; when I started I had a lot of problems and evolved my own way of working:

I put a copy of NConvert in the same folder as my batch file, which means that the code always finds NConvert, solving one early issue.

I also find using a batch file simplifies testing code variations quickly to troubleshoot problems, but that may just be due to my lack of experience working at the command line.

I was also originally looking to produce scripts that could perform multiple actions, for which a batch file is necessary.

I doubt in this case if using a batch file makes any difference to the result obtained, although as I said in other cases the code may sometimes need to be modified slightly.
punith8626 wrote: Is it possible to contact you via skype ? I need to talk to you regarding my queries related to nconvert ?
I don't use Skype and don't really want to start using it, there is also the practical problem that I am seriously overloaded with other things to do at the moment... :x
cday
XnThusiast
Posts: 4187
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: When i try to convert tiff to jpeg I get exception

Post by cday »

No problem with NConvert 7.10 32-bit...

Is your problem that you don't get an output file when I am getting one, in which case your problem may lie elsewhere?

In that case it might be best to back up a bit and try using simpler code or to check for very basic issues.

One of the problems with using the command line is that it is very intolerant of errors...