"Unable to load image in file" when directly opening (Skype)

You think you have found a bug ? You've got a suggestion to modify PhotoFiltre ? /
Ĉu vi opinias vi trovis malbonadĵon ? Ĉu vi havas sugeston por modifi PhotoFiltre ?

Modérateur : Modérateurs

Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

"Unable to load image in file" when directly opening (Skype)

Message par Ray Koopa »

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
Dernière modification par Ray Koopa le 10 nov. 2015 22:49, modifié 1 fois.
Antonio
Administrateur(trice)|Administrateur|Administratrice
Administrateur(trice)|Administrateur|Administratrice
Messages : 12835
Inscription : 28 oct. 2003 22:49

Re: "Unable to load image in file" when directly opening (Sk

Message par Antonio »

It is right, unicode are not supported.
In your sample, your usernames have spacing ?
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

Yes, my Windows username has a space between first and last name.
The Skype name has none.
Antonio
Administrateur(trice)|Administrateur|Administratrice
Administrateur(trice)|Administrateur|Administratrice
Messages : 12835
Inscription : 28 oct. 2003 22:49

Re: "Unable to load image in file" when directly opening (Sk

Message par Antonio »

i think it is the bug...
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

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.
Antonio
Administrateur(trice)|Administrateur|Administratrice
Administrateur(trice)|Administrateur|Administratrice
Messages : 12835
Inscription : 28 oct. 2003 22:49

Re: "Unable to load image in file" when directly opening (Sk

Message par Antonio »

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
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

Yeah, when associating PNG and JPG and other files, Windows wrapped my %1 paths in quotes.
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

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...
Dernière modification par Ray Koopa le 10 nov. 2015 22:49, modifié 1 fois.
Antonio
Administrateur(trice)|Administrateur|Administratrice
Administrateur(trice)|Administrateur|Administratrice
Messages : 12835
Inscription : 28 oct. 2003 22:49

Re: "Unable to load image in file" when directly opening (Sk

Message par Antonio »

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 ?
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

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.
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

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.)
Dernière modification par Ray Koopa le 10 nov. 2015 22:50, modifié 1 fois.
Antonio
Administrateur(trice)|Administrateur|Administratrice
Administrateur(trice)|Administrateur|Administratrice
Messages : 12835
Inscription : 28 oct. 2003 22:49

Re: "Unable to load image in file" when directly opening (Sk

Message par Antonio »

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:
Ray Koopa
Nouveau(elle)|Nouveau|Nouvelle
Nouveau(elle)|Nouveau|Nouvelle
Messages : 9
Inscription : 24 avr. 2015 20:16
Version de PhotoFiltre : PhotoFiltre Studio X 10.9.2
Système d'exploitation : Windows 8.1 Update 1

Re: "Unable to load image in file" when directly opening (Sk

Message par Ray Koopa »

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.