Page 1 of 2
Convert ithmb
Posted: 2013-10-16T15:11:57-07:00
by smclellan
First of all - to whom it may concern - thank you for such a powerful and simple tool. It is a lifesaver.
Secondly, I am having an issue converting .ithmb files to a usable image format. I have had some success by renaming the .ithmb to .uyvy format and then converting to a .png and/or .jpg. However, when I convert, I end up with two identical images stacked on top of one another in the size specified - the overall height is what I specified so essentially I get two half-height images on top of each other.
BACKGROUND
I began by using Keith's iPod Photo Reader (
http://keithwiley.com/software/keithsIP ... ader.shtml) and can export the files from there in a proper way (there are a lot of files and this tool only allows converting one at a time so it is practically useless for my purposes). This tool was very useful in determining some of the information about the files though. Using it, I was able to determine that they are 720x480 16-bit YCbCr 4:2:2 with Interlaced Shared Chrominance. This tool has an option to "Flip Endian" and only when that option is enabled does the exported image file display properly.
Using ImageMagick command line on a Mac, I run the command
Code: Select all
convert -size 720x480 -depth 16 -sampling-factor 4:2:2 FileName.uyvy FileName.png
The resulting image file is as described above - two half-height images stacked on top of each other with a total height of 480.
MY TROUBLESHOOTING
I have tried each option for the -endian option (LSB and MSB) with no difference in output image file. I have tried -interlace option (None, Line, Plane and Partition) with no difference in output image file.
THE QUESTION
Can the endianness of the image be flipped?
smclellan
Posts: 1
Joined: 2013-10-16T16:29:11+00:00
Re: Convert ithmb
Posted: 2013-10-16T15:25:52-07:00
by fmw42
Re: Convert ithmb
Posted: 2013-10-16T15:36:08-07:00
by smclellan
fmw42,
From what I can see, as in my post, there are only two options for the -endian option, LSB and MSB. I have tried both of those, but, full disclosure, I have no idea what endianness is or how it affects an image. Are there more options for -endian that I am not aware of. -list endian only displays those two options as well.
Re: Convert ithmb
Posted: 2013-10-16T15:44:55-07:00
by snibgo
If the two halves are identical, then one half is redundant. You could crop and resize.
If you provide a .uyvy file, someone might experiment.
Re: Convert ithmb
Posted: 2013-10-16T15:48:26-07:00
by smclellan
Snibgo, I am not 100% sure that both halves are identical, but the link provided is one of the .uyvy files for experimentation.
https://www.dropbox.com/s/fh172mbkv8m7ls5/T1016.uyvy
Re: Convert ithmb
Posted: 2013-10-16T15:51:26-07:00
by smclellan
snibgo, here is a link to the resulting file I get when converting from the uyvy to jpg (same result as with png).
https://www.dropbox.com/s/8ve2dumgzl8eunr/T1016.jpg
Re: Convert ithmb
Posted: 2013-10-16T16:30:22-07:00
by snibgo
Converting your image, chopping in half and magnifying greatly suggests the halves are similar but displaced vertically by half a pixel. This suggests the two halves should be interleaved. There may be a neater way of combining the two halves, but here is one. Windows script:
Code: Select all
convert ^
-size 720x480 -depth 16 -sampling-factor 4:2:2 ^
t1016.uyvy ^
( +clone -crop 720x240+0+0 -write t0.png +delete ) ^
( +clone -crop 720x240+0+240 -write t1.png +delete ) ^
NULL:
convert ^
xc:black xc:white -append -write mpr:m +delete ^
-size 720x400 ^
tile:mpr:m ^
mask.png
convert ^
-filter Point ^
t0.png t1.png ^
-resize 100%%x200%% ^
mask.png ^
-composite ^
t.png
With large magnification, the bottom quarter or so of the result is strangely blocky (2x2 pixels). This may be an artifact of the original compression.
Re: Convert ithmb
Posted: 2013-10-16T16:49:22-07:00
by fmw42
Is the OP on Unix or Window. If snibgo is correct, I have a script, interleave, at the link below that might help to do that on Unix.
Re: Convert ithmb
Posted: 2013-10-16T17:28:28-07:00
by smclellan
fmw42 and snibgo, I am running Mac OS Mountain Lion so Unix is my OS.
Re: Convert ithmb
Posted: 2013-10-16T17:35:38-07:00
by fmw42
smclellan wrote:fmw42 and snibgo, I am running Mac OS Mountain Lion so Unix is my OS.
What version of IM?
Please review
viewtopic.php?f=1&t=9620 if you have not already.
This question is probably out of my expertise. I do not know what a uyvy format image is and do not know if IM supports that format?
So I will leave this up to snibgo, who seems to have a better handle on it.
Re: Convert ithmb
Posted: 2013-10-16T17:40:57-07:00
by smclellan
fmw42, I am not really sure what the uyvy format is either. I am assuming that it is some type of RAW format. Is there a command I can run to determine the IM version? It is the most recent version that installs with MacPorts. I installed it today.
Re: Convert ithmb
Posted: 2013-10-16T17:52:41-07:00
by fmw42
smclellan wrote:fmw42, I am not really sure what the uyvy format is either. I am assuming that it is some type of RAW format. Is there a command I can run to determine the IM version? It is the most recent version that installs with MacPorts. I installed it today.
It looks like subsampling variant of YUV as per
http://www.fourcc.org/yuv.php and apparently packed as two pixels at a time.
It may be some form of raw image, but I do not know how IM would interpret it without one using some delegate and providing the arguments, unless there is some header information. Snibgo likely understands this better and it appears from his command that it is a raw format and he has given the correct sampling-factor. But perhaps this format requires interleave arguments as well, for which I do not know that IM has provisions. One would have to study the file format more carefully perhaps from the reference above.
You can find the IM version using the command
convert -version
But if you installed the latest from MacPorts, then it is likely only a few release older than the current IM version.
Re: Convert ithmb
Posted: 2013-10-16T17:59:07-07:00
by smclellan
This is the output of convert -version
Version: ImageMagick 6.8.7-0 2013-10-16 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC
Delegates: bzlib djvu fftw fontconfig freetype gslib jng jpeg lcms ltdl lzma png ps png tiff webp x xml zlib
IM seems to recognize the uyvy format in some fashion at least since it does convert from uyvy to png(I am assuming this, but as you know, I am very new to IM and Forums for that matter). For all I know I could convert a docx to png.
Re: Convert ithmb
Posted: 2013-10-16T17:59:31-07:00
by fmw42
Re: Convert ithmb
Posted: 2013-10-16T18:01:16-07:00
by snibgo
My script can be tidied up slightly:
Code: Select all
convert ^
xc:black xc:white -append -write mpr:m +delete ^
-size 720x400 ^
tile:mpr:m ^
mask.png
convert ^
-size 720x480 -depth 16 -sampling-factor 4:2:2 ^
T1016.uyvy ^
-crop 100%%x50%% ^
-filter Point -resize 100%%x200%% ^
mask.png ^
-composite ^
t.png
To convert my Windows script to Unix etc:
1. Change every "^" to "\". In my script, these are only at line ends.
2. Escape parentheses: change "(" to "\(" and ")" to "\)". The revised script has no parentheses.
3. Windows needs to escape "%" but Unix doesn't, so change every "%%" to "%".
I think that's all you need.
I know nothing about uyvy, but smclellan has done all the work, showing how to convert that to anything else.