Image not rendering properly - image

I'm attempting to parse an image that is possibly corrupt and it's driving me nuts trying to figure out what's wrong. Here is what I've deduced..
Example image: https://s3.amazonaws.com/edison_new/ffb3ccc402d6bd6-original
The images only show up in Chrome
Can't drag them to the desktop (on a mac).
Attempting to save them to computer yields a file that is "damaged or could not be open" when opening with Preview
Attempting to open in Photoshop yields "Could not complete your request because an unknown or invalid JPEG marker type is found."
Files are stored on Amazon S3
The meta data indicates the content-type to be image/jpeg
File definitely exists as you can see it in Chrome...
Anyone can help me deduce what is going on here??

The image is in WEBP format, its not natively supported in IE or FF so will not be displayed.
http://caniuse.com/#feat=webp
(I opened it in IrfanView to see what format it was)

Related

Internet Explorer DOM7009: Unable to decode image at URL: Mime type "image/webp"

I'm using a webpack image loader to import images and use them across my scss or js files.
The thing is, images are rended in Chrome but not on Firefox or IE.
On IE Edge I get the following error:
As my network tab shows the mime type of the image is image/jpg
And this is the response from the server.
But the images are not rendered
Anyone knows why this error is happening? I guess that it's not rendered on Firefox for the same reasons but I don't know how I can fix this. It's also happening in embedded images like:
data:image/png;Base64, .....
Any help would be appreciated, thanks in advance.
I realized that the causing of this problem was my webpack image-loader configuration. I was using webp option and thus enabling webp conversion of all images but without changing image extension. I disabled that option and all images are showing again.

Unable to copy image to clipboard in Firefox Addon development

I'm developing a Firefox Addon which has this functionality to copy an image to clipboard.
I'm using require("sdk/clipboard") lib, as described in the documentation
But when I try to attach a base64 image, it gives me the following error:
JPM [error] Message: Error: Invalid flavor for image/jpg
You can find an example of a command that tries to copy an image to the clipboard and is giving me thie error here: https://jsfiddle.net/g0Lff2b5/
When I try to use the example in the website, it works. I think that perhaps my base64 is invalid, even though I used many base64 generators, and setting this base64 into a tag works fine.
Anly ideas?
Well, I did a workaround fix that solves for now, but the main problem remain.
What I did in order to copy the image to the clipboard was to create a canvas object, add the image to it, and call the function that converts the image to a BASE64 string (.toDataURL('image/png')). then, I was able to copy this base64 to the clipboard.

file stored on s3 not rendering in browser

I am copying an image that I extract from an .ipa file on s3. The file is getting move correctly but when every I try to view it in a browsers it appear to broken, in google chrome. If I download the file directly to my machine and open it appears perfectly fine. It also renders ok in Safari.
Dir.mktmpdir do |dir|
Zip::File.open(tmp_ipa) do |zip_file|
# Find Icon File
icon = zip_file.find do |entry|
entry.name.include? 'AppIcon76x76#2'
end
icon.extract(File.join(dir, 'AppIcon.png'))
s3_icon = bucket.objects[icon_dest]
s3_icon.write(Pathname.new(File.join(dir, 'AppIcon.png')))
icon_url = s3_icon.public_url.to_s
end
end
The most likely problem is that you didn't set the Content-Type to image/png when you uploaded your image to S3. Try this on the command line:
curl -i http://your-bucket.s3.amazonaws.com/path/to/AppIcon.png
What's the Content-Type header? If it isn't image/png, set that at the time you upload.
This is almost certainly because Apple uses a non-standard proprietary extension of the PNG file format for the PNG files in an iPhone APP (archived link), such as the .ipa you say it was extracted from.
The reason it works in Safari, is because Safari uses the OS's image decoding libraries, which do support this non-standard format.
There are some conversion scripts out there, that work with varying success.

wxpython display a corupted image

Does anyone out there have a process or solution for displaying a corrupted image using wxpython. To be clear the image is corrupted but ACDSEE is still able to display it (all be it displayed corrupted), also the default windows fax/image viewer can display the image (all be it corrupted). When I try to process the image with wx I get an error and my script stops:
image.thumbnail((NewWidth, temp_height), Image.ANTIALIAS)
File "C:\Python27\lib\site-packages\PIL\Image.py", line 1559, in thumbnail
self.load()
File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 215, in load
raise_ioerror(e)
File "C:\Python27\lib\site-packages\PIL\ImageFile.py", line 52, in raise_ioerror
raise IOError(message + " when reading image file")
IOError: broken data stream when reading image file
I realize that I could just find where the error occurs and "skip" any corrupted images but I would rather be able to display them (than skip them) despite the corruption, as the two programs I mention above can. Any help/suggestions/guidance would be appreciated.
FYI. Not downing wx, I LOVE it! Ms Paint cannot display the image, it gracefully fails and gives a message that the image is corrupted (the equivalent of skipping) and MS Picture Manager actually hung on the image. So if the consensus is that wx just can't handle corrupted images I am willing to accept that and will add "skipping" code for corrupted images, but I wanted to ask the question before I did so.
I don't think wxPython supports this currently. I would just create some kind of default broken image or message that you can display instead. You might also try using the Python Imaging Library itself to open the image.
If you can find an open source image viewer that does work with corrupt images, than you should take a look at their code to see if we could patch wxPython.

Can't stream tiff image using cfcontent

We're using cfcontent to stream images from outside the web root. jpegs, pngs, and gifs all stream correctly, but I can't get any tiff files to stream. I get the broken image icon, even though I can see that the file is in the correct location and the file name is stored correctly and is being passed correctly.
The code is really simple - the displaying page has
<img src="?file=common/includes/displayPhoto.cfm&thisImage=someImage.tiff" />
and displayPhoto.cfm has
<cfcontent type = "image/*" file = "#imagePath#" deleteFile = "No">
where #imagePath# has the fully qualified file path.
I'm at a loss - and my friend Google has let me down.
You're probably doing it right. The problem is that most browsers do not support TIFF. The only browser that does (and not all TIFF formats, at that!) is Safari.
On Firefox, Internet Explorer, Google Chrome, Opera etc, you will always see the broken image icon - because to the browser that image is indeed "broken", unintelligible.
See also Display TIFF image in all web browser
Your URL is wrong actually: You have something.cfm&x=y. In URL's, you begin with a question mark: something.cfm?x=y.

Resources