goldenix Posted March 13, 2009 Share Posted March 13, 2009 (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 March 13, 2009 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] Link to comment Share on other sites More sharing options...
PsaltyDS Posted March 13, 2009 Share Posted March 13, 2009 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. 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 Link to comment Share on other sites More sharing options...
BinaryBrother Posted March 13, 2009 Share Posted March 13, 2009 (edited) I posted something kinda dumb a min ago... Hopefully I removed it before very many people seen it ... 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... 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... Edited March 13, 2009 by BinaryBrother SIGNATURE_0X800007D NOT FOUND Link to comment Share on other sites More sharing options...
goldenix Posted March 13, 2009 Author Share Posted March 13, 2009 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 : 89504E47I 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] Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now