Convert ithmb

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: Convert ithmb

Post by fmw42 »

snibgo,


IM does have a setting, for interlace of raw images, but I am not sure that is what you need. But you can try that. See http://www.imagemagick.org/script/comma ... #interlace
smclellan
Posts: 11
Joined: 2013-10-16T14:29:11-07:00
Authentication code: 6789

Re: Convert ithmb

Post by smclellan »

Before I go any further, Thank you both. Seriously, it is kinda awesome to get this much help so quickly.

snibgo, I placed your code into a file called fix.sh and made the changes to the double %'s and ^'s per your instrucitons. When I run it -

Code: Select all

sh fix.sh T1016.png
I get

Code: Select all

fix.sh: line 2: fg: no job control
fix.sh: line 8: fg: no job control
Am I doing this properly?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert ithmb

Post by snibgo »

I think bash shell needs a hash-bang-bin-bash first line thingy.
fmw42 wrote:IM does have a setting, for interlace of raw images...
Yes, I saw that, couldn't make it do anything useful. Or anything at all.
snibgo's IM pages: im.snibgo.com
smclellan
Posts: 11
Joined: 2013-10-16T14:29:11-07:00
Authentication code: 6789

Re: Convert ithmb

Post by smclellan »

snibgo, scratch that, I figured out the issue with my script. Below are the changes -

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
You are a freaking genius, IMHO. The resulting image is perfect. https://www.dropbox.com/s/pk30221axinp9um/t.png

Thank you both again. If I can work this out into a script to encompass all the steps, I will post it. I know if it helped me, someone out there is looking for a solution too.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert ithmb

Post by snibgo »

Good stuff. I corrected my script a few seconds after posting it. Change a line from ...

Code: Select all

-crop 100^^x50% \
... to ...

Code: Select all

-crop 100%x50% \
snibgo's IM pages: im.snibgo.com
smclellan
Posts: 11
Joined: 2013-10-16T14:29:11-07:00
Authentication code: 6789

Re: Convert ithmb

Post by smclellan »

I've made those changes to the fix.sh script. It works both ways - don't know why - but here's the modified code.

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

Re: Convert ithmb

Post by fmw42 »

You can actually combine this into one command line. See if this works. It seems to for me.


convert \
xc:black xc:white -append -write mpr:m +delete \
-size 720x480 \
tile:mpr:m -write mpr:tile +delete \
-size 720x480 -depth 16 -sampling-factor 4:2:2 \
T1016.uyvy \
-crop 100%x50% \
-filter Point -resize 100%x200% \
mpr:tile \
-composite \
t2.png
Last edited by fmw42 on 2013-10-16T19:36:50-07:00, edited 1 time in total.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Convert ithmb

Post by snibgo »

Agggghhh ... I made a mistake. For mask.png, I wrote:

Code: Select all

 -size 720x400 \
This should be the same size as the desired image, so:

Code: Select all

 -size 720x480 \
And this explains the blockiness at the bottom of the result. With this correction, the blockiness vanishes.

Sorry about that. (fmw42's latest script also needs this correction.)
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: Convert ithmb

Post by fmw42 »

Sorry about that. (fmw42's latest script also needs this correction.)
Thanks for pointing that out. I have edited my script above.
smclellan
Posts: 11
Joined: 2013-10-16T14:29:11-07:00
Authentication code: 6789

Re: Convert ithmb

Post by smclellan »

Hey everybody,
I hope this will help someone out in the future. The following script will take *.ithmb files from an iPod Photo Cache and convert them into usable PNG files.
****Please note, this was written for *.ithmb files from an iPhone Photo cache. I believe it would work with *.ithmb files for any iDevice with the proper changes to the

Code: Select all

-size 720x480 -depth 16 -sampling-factor 4:2:2
options in the second convert section and the proper changes to the

Code: Select all

-size 720x400
option in the first convert section to create the properly sized mask.png file.****

This code is for UNIX-based OSes, but also could be modified for Windows I suppose - I have no idea how to do that nor do I particularly care to learn so you are on your own for that part.

Just copy and paste the code into a new file and name it Convert.sh (or something similar with the .sh extension) and then run it from within the folder with the *.ithmb files from the terminal with

Code: Select all

sh Convert.sh


You will end up with 3 versions of each ithmb file - one *.ithmb version, one *.uyvy version (this is simply a renamed version of the ithmb file used for imagemagick's convert command) and a *.png version (the usable version).

Special thanks to snibgo and fmw42 here and to Keith Wiley for Keith's iPod Photo Reader http://keithwiley.com/software/keithsIP ... ader.shtml.

Code: Select all

for img in *.ithmb; do
filename=${img%.*}
cp "$filename.ithmb" "$filename.uyvy"&&
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 \
"$filename.uyvy" \
-crop 100%x50% \
-filter Point -resize 100%x200% \
mask.png \
-composite \
"$filename.png"
done
vipinbeniwal
Posts: 1
Joined: 2014-03-20T20:15:32-07:00
Authentication code: 6789

Re: Convert ithmb

Post by vipinbeniwal »

I need to covert ithmb file on my windows PC programmatically either using any script or command line or programing in c++,vc++ or any other

could you help me and guide me how can i do this on windows.



thanks.
RDS3
Posts: 2
Joined: 2014-09-10T09:35:42-07:00
Authentication code: 6789

Re: Convert ithmb

Post by RDS3 »

The utility works great

I have a big ITHMB file 500MB with many photos. I use windows.

The following commands work fine.

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 F1019_3.uyvy -crop 100%x50% -filter Point -resize 100%x200% mask.png -composite F1019_1.png

The problem is it converts 1 image. The ithmb has many images.

Is there a way to break them into multiple files and then use the above commands so that I get a png output for all photos?

Whats the eof character that can be used to break the ITHMB into?
RDS3
Posts: 2
Joined: 2014-09-10T09:35:42-07:00
Authentication code: 6789

Re: Convert ithmb

Post by RDS3 »

Please ignore earlier question. Found answer on other forums. ITHMB file size / 720*480*2 = Number of photos in the file.
Post Reply