JPG不能仅在Android中加载 [英] JPG not loading in Android only
问题描述
我一直在Windows机器上通过imagemagick对图像进行重采样.绝大多数都可以正常工作,但是一两个图像不会在任何Android设备上加载.我以为是我的Java应用程序代码已损坏,但我也可以在Android设备上的Chrome中重现它.
I have been resampling images via imagemagick on a windows machine. Vast majority work fine however there are one or two images that won't load on any android device. I thought it was my java app code that was broken but I can reproduce it in Chrome on the Android device too.
图像只能在iOS/PC/Mac上很好地加载,而不能在android上很好地加载.在10Kb的数据中只有320x44像素,并且没有看到任何错误消息,使用imagemagick使其工作时,有人可以阐明我可能做过的事情(或错过的步骤)吗?
The images load fine on iOS/PC/Mac only just not on android. It's only 320x44 pixels in 10Kb of data and not seeing any error messages, can anyone shed some light on what I may have done (or steps I've missed) when using imagemagick to get this to work?
这是JPG的链接
http://gatherhelp.com/tests/corruptjpg/broken.jpg
UPDATE 我已经使用查尔斯"拦截了来自电话的网络流量并查看了此请求,这也表明我确实收到了一个白色图片,作为对此URL的响应.安卓.
UPDATE I've used 'Charles' to intercept the network traffic from the phone and view this request and that too shows I am indeed being delivered a white image as a response to this URL from the android.
我在服务器上使用PHP,但未处理JPG文件,仅直接处理了文件
I'm using PHP on the server but JPG files are not processed, merely straight through file served
推荐答案
我知道回答您自己的问题的方式很差,但以防万一这对其他人有帮助...看来问题出在我转换了一些PSD和其他原本用于打印的文件,并且这些文件具有CMYK颜色格式而不是RGB.
I know it's poor form to answer your own question but just in case this helps anyone else... It appears that the issue was I converted some PSD and other files that were originally made for printing and had the CMYK color format instead of RGB.
要找到答案,我使用了ImageMagick的Identify命令并做到了
To find this out I used ImageMagick's Identify command and did this
Identify -verbose broken.jpg
给予
Image: broken.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 256x256+0+0
Resolution: 250x250
Print size: 1.024x1.024
Units: PixelsPerInch
Type: ColorSeparation
Endianess: Undefined
Colorspace: CMYK
Depth: 8-bit
这表明颜色空间是CMYK,因此对其他损坏图像的快速测试表明它们都存在相同的问题.要将它们再次转换为ImageMagick进行救援并使用
This showed the colorspace was CMYK so a quick test of the other broken images showed they all had the same issue. To convert them again ImageMagick to the rescue and used
convert broken.jpg -colorspace RGB fixed.jpg
因此,看来iOS/PC/Mac都支持具有CMYK的JPEG,但Android似乎不支持或至少不是所有CMYK图像(自Android 4.2起)
So it appears iOS/PC/Mac all support JPEGs that have CMYK but Android appears not to or at least not all CMYK images (As of Android 4.2)
这篇关于JPG不能仅在Android中加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!