Convert 12bit grayscale JPEG

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
FredZ
Posts: 2
Joined: 2019-06-06T01:25:04-07:00
Authentication code: 1152

Convert 12bit grayscale JPEG

Post by FredZ » 2019-06-06T01:50:59-07:00

I am trying to convert a 12bit grayscale image to 8bit grayscale JPEG:

magick identify "I59336.img"
identify: Unsupported JPEG data precision 12 `I59336.img' @ error/jpeg.c/JPEGErrorHandler/340.

I am not able to do this:
magick convert -size 2954x1435 -depth 12 -auto-level gray:I59336.img I59336.jpg
convert: unexpected end-of-file 'I59336.img': No such file or directory @ error/gray.c/ReadGRAYImage/241.
convert: no images defined `I59336.jpg' @ error/convert.c/ConvertImageCommand/3273.

FFMpeg works however:
ffmpeg -i I59336.img I59336.jpg

[jpeg_pipe @ 000001d18b636220] Format jpeg_pipe detected only with low score of 25, misdetection possible!
Input #0, jpeg_pipe, from 'I59336.img':
Duration: N/A, bitrate: N/A
Stream #0:0: Video: mjpeg, gray16le(12 bpc, bt470bg/unknown/unknown), 2954x1435 [SAR 104:104 DAR 422:205], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler @ 000001d18cd80240] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'I59336.jpg':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: mjpeg, yuvj444p(pc), 2954x1435 [SAR 1:1 DAR 422:205], q=2-31, 200 kb/s, 25 fps, 25 tbn, 25 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 1 fps=0.0 q=6.6 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.404x
video:125kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown

How can I perform the conversion with ImageMagick?

snibgo
Posts: 12306
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert 12bit grayscale JPEG

Post by snibgo » 2019-06-06T03:20:38-07:00

As far as I know, IM cannot read 12-bit/channel JPEG images.

I suggest you link to sample 12-bit inputs. A developer may take a look.
snibgo's IM pages: im.snibgo.com

FredZ
Posts: 2
Joined: 2019-06-06T01:25:04-07:00
Authentication code: 1152

Re: Convert 12bit grayscale JPEG

Post by FredZ » 2019-06-06T03:39:44-07:00


Post Reply