PhotoFiltre
http://www.photofiltre-studio.com/forum/

"Unable to load image in file" when directly opening (Skype)
http://www.photofiltre-studio.com/forum/viewtopic.php?f=15&t=21199
Page 1 of 1

Author:  Ray Koopa [ 24 Apr 2015 20:26 ]
Post subject:  "Unable to load image in file" when directly opening (Skype)

I have a really weird issue since some recent Skype versions. Image files sent to me and opened directly through Skype refuse to open.
PhotoFiltre just shows the following error message (my usernames have been blanked):

The file _does_ exist and it can even be opened manually. It just doesn't work when opening it directly from Skype.
It happens to both PNG or JPG files, so I think the file format doesn't matter. It seems to be a bug elsewhere.

On a side note, I noticed the same issue with file names containing unicode characters, they refuse to open on direct startup.

Can I provide more information to help fixing this bug? It makes me a bit nervous, as I often receive images through Skype :3c

Author:  Antonio [ 25 Apr 2015 8:09 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

It is right, unicode are not supported.
In your sample, your usernames have spacing ?

Author:  Ray Koopa [ 26 Apr 2015 12:03 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Yes, my Windows username has a space between first and last name.
The Skype name has none.

Author:  Antonio [ 26 Apr 2015 16:02 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

i think it is the bug...

Author:  Ray Koopa [ 29 Apr 2015 20:40 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Can you fix it? I cannot rename my Windows profile (even if I would, the folder name would still be the same).
I can try a new user account without a space though.

Author:  Antonio [ 29 Apr 2015 21:18 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Not sure the bug is in PFS...

First edit the windows association for the type jpeg with windows file explorer.
Check that %1 is enclosed like this "%1" in the open key

Author:  Ray Koopa [ 10 May 2015 14:27 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Yeah, when associating PNG and JPG and other files, Windows wrapped my %1 paths in quotes.

Author:  Ray Koopa [ 04 Jul 2015 12:28 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

That also doesn't seem to be the problem. I moved such an image to "D:\Pictures\a.jpg" and opened it manually, and it didn't want to load it.
Must be the image data itself, as it seems. I uploaded the screenshot someone sent me here:
EDIT: Funny enough, it's actually a PNG, but Skype seems to store them with a JPG extension. That might already be the problem. The extension cant be trusted...

Author:  Antonio [ 04 Jul 2015 14:46 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

it can not be a jpeg because i see transparency in your screen :wink:
Perhaps a png, can you post this image here to test ?

Author:  Ray Koopa [ 16 Jul 2015 17:28 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Yeah, I will, when I'm at home (check back in 2 hours). =3

Basically, just rename a JPG to .png and try to open it.
Skype seems to be stupid enough to always append ".jpg" to the image, nevertheless of the real format in it. Most programs don't trust these extensions for security reasons, and try to find the correct image loader by looking at the image data, but PFX is tricked into trying to load the PNG as a JPG due to the extension given, and then just shows this error.

Thanks for your quick replies until now, as said, a problematic image will follow soon.

Author:  Ray Koopa [ 16 Jul 2015 19:01 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Here is the image:

(That is exactly the dumb name Skype gives. Notice it's a PNG image actually, but with JPG extension. Copy the whole link manually to open it.)

Author:  Antonio [ 16 Jul 2015 19:37 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

When i save it with Firefox, Firefox add th extention .png and i can open it with PhotoFiltre.

Of course if i remove the extension .png, PhotoFiltre will open it as a jpeg and display an error message :wink:

Author:  Ray Koopa [ 17 Sep 2015 19:06 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Yeah, I know that.

But a program should never rely on file extension (mostly due to security reasons, and a bug like this)...

Right now PhotoFiltre does rely on the file extension.

A correct, non-breaking change would be:
- Try to use the file extension.
- If the loader returns an error, don't show it to user, and try probing for the real image type (by checking the file header etc)
- If one is matched, try loading with that.
- If it still doesn't work, show error.

Do you think that can be made possible? =3

Of course, if probing is tested successfully and working well, a good program would just behave like this.
- Probing for the real image type (by checking the file header etc)
- If one is matched, try loading with that.
- If it doesn't work, show error.

I did this once for a game engine which required loading of WAV, OGG and MP3 files. Each filetype was programmed in a subclass of a Loader class, and offered a "Probe" method returning a boolean whether if it matches this type. The Probe method basically just loaded the header and looked if the stats given in it are valid (if possible).

When loading an image then, I just called the Probe method of each instance I made of each subclass, and used the first returning true.
It can now load WAV files correctly, even though if a dumb user or program renamed it to MP3 or TXT or whatever.

I wrote myself a "preloader" for PFS checking the file type by the image data, and creating a copy with correct extension before passing it to PFS.

Author:  JerrellDin [ 26 Sep 2017 17:56 ]
Post subject:  Re: "Unable to load image in file" when directly opening (Sk

Antoenio wrote:
When i save it with Firefox, Firefox add the fat burners for women extention .png and i can open it with PhotoFiltre.

Of course if i remove the extension .png, PhotoFiltre will open it as a jpeg and display an error message :wink:


Is anyone else still having this issue?

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/