开发者

Android imageview only accepts some jpg's

I have an image view in my app. when I try to make it show a jpg file exported from 3ds max, it works. But if it comes from Photoshop, it just does nothing. Why is that? If it is at all important my app gets the image from my server with the following code:

public static Bitmap getWebImage(String URL)
{
    URL myImageURL = null;

    Bitmap bitmap = null;

    try {

        myImageURL = new URL(URL);

        } catch (MalformedURLException error) {


        error.printStackTrace();

        }
        try {

            HttpURLConnection connection = (HttpURLConnection)myImageURL .openConnection();

            connection.setDoInput(true);

            connection.conne开发者_StackOverflowct();

            InputStream input = connection.getInputStream();

            bitmap = BitmapFactory.decodeStream(input);

            } catch (IOException e) {


            e.printStackTrace();

            }

            return bitmap;

}


Can you check the color settings of your JPG files? Most likely your JPG files from photoshop is in CMYK rather than RGB, and Android simply doesn't support CMYK.


Would it be possible for you to upload the two pictures for comparison?


public static Bitmap getWebImage(String URL) { URL myImageURL = null;

Bitmap bitmap = null;

try {

myImageURL = new URL(URL);

} catch (MalformedURLException error) {

error.printStackTrace();

} try {

HttpURLConnection connection = (HttpURLConnection)myImageURL .openConnection();

connection.setDoInput(true);

connection.connect();

InputStream input = connection.getInputStream();

bitmap = BitmapFactory.decodeStream(input);

} catch (IOException e) {

e.printStackTrace();

}

return bitmap;

}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜