Ant wrote:
On 3/27/2013 4:08 AM PT, Jim Taylor typed:

... I was wondering why my saved JP(E)G image didn't show up
correctly. I noticed my 3.5 MB file was actually a text file with
encoded attachment:

--Apple-Mail-ABD6ED3D-0515-4E05-BC44-0EC8E2F9C77B
Content-Type: image/jpeg;
     name=photo.JPG
Content-Disposition: inline;
     filename=photo.JPG
Content-Transfer-Encoding: base64
<< bunch of letters and numbers >>
--Apple-Mail-ABD6ED3D-0515-4E05-BC44-0EC8E2F9C77B
Content-Type: text/plain;
     charset=us-ascii
Content-Transfer-Encoding: 7bit


How can I get this image out? I no longer have the original e-mail
anymore, but do have this saved file (e-mail + encoded image). I tried
copying this file into my SM to see if SM mail could read it. Nope!

Remove the header and footer and run the << bunch of letters and
numbers
 >> through a base 64 decoder.  The result should be a jpg file.

I assume I can use my 64-bit Debian stable's base64 command, but it
doesn't seem to work:

$ base64 -d savedfile.txt
▒▒▒▒-▒ExifMM*
             ▒
▒base64: invalid input

Maybe I did that wrong? :(

First off verify that it is actually an inline jpg and remove everything before the beginning of the jpg. The inline jpg begins with hex ff d8 ff e0 which when base64 encoded is hex 2f 39 6a 2f.

C:\toolsjim>dump encoded.txt | head -3
encoded.txt:
00000000  2f39 6a2f 3441 4151 536b 5a4a 5267 4142 /9j/4AAQSkZJRgAB
00000010  4151 4541 7441 4330 4141 442f 3454 7732 AQEAtAC0AAD/4Tw2

C:\toolsjim>dump decoded.jpg | head -3
decoded.jpg:
00000000  ffd8 ffe0 0010 4a46 4946 0001 0101 00b4 .X.`..JFIF.....4
00000010  00b4 0000 ffe1 3c36 4578 6966 0000 4d4d .4...a<6Exif..MM

If it looks like a valid jpg try using the ignore error switch of your base64 decoder. Also realize that if you don't supply an "outfile" to the command it decodes to the screen.

base64 -di infile.txt outfile.jpg

--
Jim
_______________________________________________
support-seamonkey mailing list
[email protected]
https://lists.mozilla.org/listinfo/support-seamonkey

Reply via email to