Sign in to follow this  
Followers 0
goldenix

Inetget image with correct extension

4 posts in this topic

#1 ·  Posted (edited)

Im downloading images with autoit & my image URL ends with .jpg so I save it as jpg. But when I open it with irfanview it says its png or gif file instead & asks if I want to rename it.

If I try to save it with firefox, it saves the image as png. Same happens with IE, it recognizes that its png file.

link from the webpage source code points also to jpg image.

But If I save with incorrect file extension My programs I use to display images Error & are eather unble to display those images or ask if I want to rename the image.

Any ideas that can help me out hire?

Hire is the image:

http://hentaigif.net/?level=picture&id=30905

Edited by goldenix

My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites



Im downloading images with autoit & my image URL ends with .jpg so I save it as jpg. But when I open it with irfanview it says its png or gif file instead & asks if I want to rename it.

If I try to save it with firefox, it saves the image as png. Same happens with IE, it recognizes that its png file.

link from the webpage source code points also to jpg image.

So, you (or others) have renamed the source files as .jpg even though they are actually .png or .gif, and since they were only renamed and not converted, the internal headers still say what they really are.

But If I save with incorrect file extension My programs I use to display images Error & are eather unble to display those images or ask if I want to rename the image.

Any ideas that can help me out hire?

Hire is the image:

What does "incorrect file extension" mean? Looks like .jpg is the incorrect file extension. Are you saying if you save the .png as a .png it can't be opened, but can if renamed .jpg? That would be quite odd.

:P


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I posted something kinda dumb a min ago... Hopefully I removed it before very many people seen it :P ... but I do come back with something useful...

Meta-data shows that the image is in fact a PNG, thats why browsers are trying to download it AS a PNG when it is in fact 'named' a jpg... The file on the server has the WRONG extension, that or the meta-data some how got changed, which sounds more unlikely than a bad extension... :unsure:

You should be able to...

InetGet("http://hentaigif.net/images/hfh_gallery/tatoeba_haha_ga_volume_2_chapters_5-6/000tatoebach5.hentaifromhell.net.jpg","C:\test.png")

Worked perfect for me... :D

Edited by BinaryBrother

Share this post


Link to post
Share on other sites

That is right, all I need to do is to rename the file from*.jpg to .*png & the problem is solved. But I need to be sure before renaming anything, cuz maybe Ill rename jpg to png & the file is actually in jpg format , bahh...

So I did some experiments & created multiple png files with different programs & compared first 4 bytes with fileread function & it seems that they are unique & are never changing: I found out that this is for png files : 89504E47

I will do this, Download the file & compare first 4 bytes & if match = rename to png. It seems that this is the only way I can think of at the moment.

I searched the net, but I cant find it. Maybe someone knows? How can file info programs recognize file types? in the file, there must be some static data somewhere that never changes. But where to look for it? or will those 4 bytes comparison approach work for all image files?


My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0