Invalid files DPX -> TIF

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Invalid files DPX -> TIF

Post by fmw42 »

convert $filename -set reference-black 0 -set reference-white 1023 -set gamma 1.0 -colorspace Gray -depth 16 PNG:- | convert -define png:swap-bytes - ../convertedTIFs/${filename%.dpx}_gl.tif
What is the % doing? Do you mean

convert $filename -set reference-black 0 -set reference-white 1023 -set gamma 1.0 -colorspace Gray -depth 16 PNG:- | convert -define png:swap-bytes - ../convertedTIFs/${filename}_dpx_gl.tif
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

That code was written by the author of the software we're using, and it works (the percent sign). To be honest, it's been years since I did any real shell scripting, so I'm going with what he did. That said, I did a little more research into the miff format, and I was able to get the script to run without the most recent errors using the following line:

Code: Select all

convert $filename -set reference-black 0 -set reference-white 1023 -set gamma 1.0 -colorspace Gray -depth 16 miff:- | convert -define png:swap-bytes - ../convertedTIFs/${filename%.dpx}_gl.tif
...however, the resulting TIFF files still don't work.

I'm going to see about upgrading LibTIFF, maybe that will address the issue. My version is a bit old.

Thanks
Last edited by friolator on 2014-02-19T14:45:12-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Invalid files DPX -> TIF

Post by fmw42 »

convert $filename -set reference-black 0 -set reference-white 1023 -set gamma 1.0 -colorspace Gray -depth 16 miff:- | convert -define png:swap-bytes - ../convertedTIFs/${filename%.dpx}_gl.tif
I am surprised that this works, since you have converted to a temp MIFF format which is not PNG and then used the PNG specific byte swap command.

glennrp would have to comment whether he put that command into MIFF as well as PNG.
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

Well, like I said - the resulting file is no good, so it's entirely possible that it didn't work and is just ignoring that flag.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Invalid files DPX -> TIF

Post by fmw42 »

My guess is that your scripting system is choking on the pipe. Try separating into two command lines saving as PNG as snibgo had recommended and see if that works for one single image. Presumably your IM version is newer than the png:swap-bytes command.


2014-01-30 6.8.8-5 Glenn Randers-Pehrson <glennrp@image...>
Fixed new "-define png:swap-bytes" option (reference viewtopic.php?f=2&t=24818).
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: Invalid files DPX -> TIF

Post by glennrp »

fmw42 wrote:
... convert -define png:swap-bytes - ../convertedTIFs/${filename%.dpx}_gl.tif
I am surprised that this works, since you have converted to a temp MIFF format which is not PNG and then used the PNG specific byte swap command.

glennrp would have to comment whether he put that command into MIFF as well as PNG.
No, I did not.
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

What is the % doing?
It's a wildcard. because the folder is full of numbered DPX files, that's accounting for that number, which is variable. The convert command, in this shell script, lives within a loop that iterates through all the files in the target folder.
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

Ok, I'm still having issues here. I've done a few updates, so here's the current setup:

Hardware: MacPro 8-core 3,1 -6GB RAM, 2x 2.8GHz Xeon, with OS X 10.6.8 Snow Leopard
Version: ImageMagick 6.8.8-7 Q16 x86_64 2014-02-18 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2014 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib x xml zlib
LibTIFF has been updated to 4.0.3
I'm testing target images in Photoshop CS4 and Preview on the Mac

The ultimate goal is to convert 16bit scan files (DPX or TIF) to monochrome TIF, for processing in another application. Per the suggestions in this thread, I'm trying to make PNG files as an intermediate, but it's failing just like it does going direct to TIF.

In the simplest scenario:

Code: Select all

convert sourcefile.dpx target.png
...The resulting PNG files cannot be opened, UNLESS the source is 10 bit DPX Monochrome, and then, only in Photoshop - However, the file is no good: all of the image is in the top 1/4 of the frame and is skewed looking. The rest of the frame is black. I've tried with 10 and 16 bit Linear color DPX, and 10 & 16bit Monochrome DPX as source files. In all cases, IM processes the image and outputs png files, but only the files that originated as 10 bit mono result in a file that can be opened, and that file is no good.

Our scanner can also scan to TIF files directly, though they're color, not grayscale, which is what we need. I have scanned to 8 & 16bit Linear, and 16bit Log TIFFs. When I run these through convert using the same command as above (convert sourcefile.tif target.png), I get the following errors, with all of the above TIF formats:

Code: Select all

convert: no decode delegate for this image format `sourcefile.tif' @ error/constitute.c/ReadImage/555.
convert: no images defined `target.png' @ error/convert.c/ConvertImageCommand/3147.
So this leads me to believe there's something else up with my system because others are able to make intermediate PNG files and TIFs from my DPX files, but I am not. Any ideas? Any other info I can provide?

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

Re: Invalid files DPX -> TIF

Post by snibgo »

friolator wrote:I've tried with 10 and 16 bit Linear color DPX, and 10 & 16bit Monochrome DPX as source files.
Can you supply an example of each DPX that doesn't work?
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Invalid files DPX -> TIF

Post by fmw42 »

Delegates: bzlib x xml zlib
You have no delegates for jpg, png or tif

You need to install those delegates and others and then reinstall IM

I am on Mac OSX Snow Leopard. What I do is load all my delegates from MacPorts. Then I install IM manually referencing the delegates to /opt where MacPorts puts them. I modify my ./config file something like as follows (I am not on my usual computer right now):


./configure CPPFLAGS='-I/opt/local/include' LDFLAGS='-L/opt/local/lib' \
--enable-delegate-build --enable-shared --disable-static \
--with-modules --with-quantum-depth=16 --with-gslib --without-wmf \
--disable-silent-rules --disable-dependency-tracking \
--with-gs-font-dir=/opt/local/share/ghostscript/fonts/ --with-lqr


see
http://www.imagemagick.org/script/advan ... #configure

Here are my current delegates on an older computer:

DELEGATES bzlib fftw fontconfig freetype gs jpeg jng jp2 lcms2 lqr openexr pango png tiff x11 xml zlib
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

snibgo wrote:Can you supply an example of each DPX that doesn't work?
Absolutely. Here you go:

DPX 10 Bit Mono: https://www.dropbox.com/s/ga1eskkk073j7 ... it_009.dpx
DPX 16 Bit Mono: https://www.dropbox.com/s/akf2mgxtixw43 ... it_009.dpx

DPX 10 Bit Color: https://www.dropbox.com/s/8gzf0lme33rtc ... it_016.dpx
DPX 16 Bit Color: https://www.dropbox.com/s/qlaz9hdkmk47m ... it_016.dpx

And for good measure, also direct from our scanner:
TIFF 16 Bit Log: https://www.dropbox.com/s/phobsbvs9q0me ... og_009.tif
TIFF 16 Bit Linear: https://www.dropbox.com/s/xxz22ij3mupn1 ... in_005.tif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Invalid files DPX -> TIF

Post by fmw42 »

see my post above about your missing delegates
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

fmw42 wrote:
Delegates: bzlib x xml zlib
You have no delegates for jpg, png or tif
Aha! I followed the quick install instructions and assumed all of those formats would be supported out of the box. Assumptions...

I'll get those installed and reinstall IM this afternoon, and report back.

Thanks!
friolator
Posts: 23
Joined: 2014-02-18T15:57:30-07:00
Authentication code: 6789

Re: Invalid files DPX -> TIF

Post by friolator »

Ok, delegates installed and now I'm able to get it working at a basic level from DPX direct to TIF in one line:

Code: Select all

convert $filename -define png:swap-bytes -set depth 16 -colorspace Gray ../convertedTIFs/${filename%.dpx}_gl.tif
Thanks for all the help!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Invalid files DPX -> TIF

Post by snibgo »

If your input is DPX then I expect that "-define png:swap-bytes" does nothing at all, and is best removed from the command.
snibgo's IM pages: im.snibgo.com
Post Reply