views:

89

answers:

3

I get the following output after running the code for a picture

[1459]./image_info.pl lah.png 
$VAR1 = {
          'width' => 206,          'file_media_type' => 'image/png',
          'file_ext' => 'png',
          'PNG_Chunks' => [
                            'IHDR',
?V?????O?H??^#?C&?fu?M?5V??m6???M?s',
                            'IEND' 9   :˺??:?E??(;t??[/????o?4?4?O??TܲD
#PJ?EHͨ??ƥ8???#u   ?t??1?I/=?!w"???)?,??????X?|?{                                              M?N??A?  V``?&?
{8.?"???I)?W?_??|k?.c??l??s?8?~^Z??????_;?,,+,/?4~]ů?ZìU?+???i?s`C}??/?_??>?d~?lrn?n^???2???z?-???B??n?D;??aXHoeh?3???
DA5?N?Aw??? ???J?-????P?> 'RGB',
C?~&?1?cd 'heiga~H.`ha162,         H2?I???P?p?HsZ?&?P? Y`??;?q4Kov??3?Z???L???? ?F??&???aq?H???????"Ri?F? ??ٵ???L  B??r??H%??@??٩qiLJ?pres??on' => 'Deflate',
        ??/?Z?w,?k???g?=> '2835 dpm',
          'Compression' ? ((~??_^A ?c?vV??w????m,7????Eb???0J5?? ??? ????9????:?,24m[1460]

I do not understand the last bit of the file.

How can you change the encoding to be readable?

+1  A: 

You're displaying a binary chunk as text. That's not gonna be readable in any encoding.

Andomar
A: 

Redirect the output of your script to a file:

./image_info.pl lah.png >log.txt 2>&1

Then open log.txt in your favorite GUI text editor (e.g. kate, gedit, notepad++), specifying ISO-8859-1 or UTF-8 in the open dialog. Try both encodings.

pts
Your command does not work.
Masi
It does work for me on Linux. Could you please copy-paste the error message you get?
pts
+4  A: 

The Perl Image::Info module shouldn't be displaying all of that encoded data at all. My own tests of that module have never done that, e.g:

$VAR1 = {
          'width' => 58,
          'file_media_type' => 'image/png',
          'file_ext' => 'png',
          'PNG_Chunks' => [
                            'IHDR',
                            'IDAT',
                            'IEND'
                          ],
          'PNG_Filter' => 'Adaptive',
          'color_type' => 'Gray',
          'height' => 56,
          'SampleFormat' => 'U8',
          'Compression' => 'Deflate',
          'resolution' => '1/1'
        };

Try it on another PNG file, this one looks like it might be corrupted.

Alnitak
@Alnitak: I run the script on Google's logo. I get a long list of different colors. Is the list a complete list of the colors in Google's logo?
Masi