Hi!
I’m using a PNG logo on my web app, and when i run the app, the color of the logo (and other images) changes!
Look at the original image:
Now look at the image when i run the app:
Is this a bug, or i’m missing something?
Alex
Hi!
I’m using a PNG logo on my web app, and when i run the app, the color of the logo (and other images) changes!
Look at the original image:
Now look at the image when i run the app:
Is this a bug, or i’m missing something?
Alex
It’s a problem with how you’re saving the PNG from Photoshop.
When making graphics for web, you need to use the “Export for Web” menu item (or whatever it’s called, I haven’t used Ps in a while) It’s key combination is usually cmd-shift-e
. This should fix your issues.
@Tim Parnell i never needed to use this on any other php site. This is specific for XOJO?
Alex
Indeed there is a difference. I downloaded your logo.png example.
I placed two imageviews on the same WebPage, one using the picture dragged into the project, the other pointing to your picture URL.
The image dragged into the project is somewhat denser.
I tend to avoid dragging pictures into the project anyway, as that creates an additional burden on the app to serve the picture, and is much slower anyway. If you use Picture URL, they will displayed much faster, EXACTLY like they do in php or html, with a src tag.
It has to do with color profiles from Photoshop. I could have explained it better a few years back, but I have since forgot the specifics. Basically you should always be using Save for Web when sharing the images via websites.
[quote=255955:@Michel Bujardet]Indeed there is a difference. I downloaded your logo.png example.
I placed two imageviews on the same WebPage, one using the picture dragged into the project, the other pointing to your picture URL.
The image dragged into the project is somewhat denser.
I tend to avoid dragging pictures into the project anyway, as that creates an additional burden on the app to serve the picture, and is much slower anyway. If you use Picture URL, they will displayed much faster, EXACTLY like they do in php or html, with a src tag.[/quote]
@Michel Bujardet how can i use picture URL from my LOCAL folder? like f=getfolderitem("").child(“logo.png”)?
That is way more vicious.
The reason has to do with the way Xojo loads pictures on Mac. When a picture is dragged into the project, Xojo loads it, and then serves it as a WebFile. When the picture is loaded, Xojo applies the current color profile. And serves that altered version, which again is interpreted by the screen renderer, resulting in a double dose of color distortion. LIke passing music twice through an equalizer.
The same program I used to evidence the issue on Mac, when run on PC, shows identical colors.
I have all the reasons to believe a Linux host would not suffer the same plight either.
So unless the program runs on a Mac, the color change will not occur.
The solution on Mac is probably to manage the file serving by pointing a folderitem to the picture file and creating a WebFile with WebFile.Open and point to the WebFile.URL. It should deal with the file as binary, without loading it as picture, so colors will not be distorted.