Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by robert_d · May 12, 2012 at 05:49 PM · androidimage

Why images in Android project are blurry?

I am writing comic viewer for Android. But there is one problem - images of the pages extracted from .cbr or .cbz files are blurry (the blur isn't big, but is noticeable) in the editor and in the phone when I am working on Android project. But when I change project type to desktop app, the images are sharp, why?

Here is how I extract images, I use SharpCompress library:

 using System.IO;
 using SharpCompress.Archive;
 using UnityEngine;
 
 class SharpCompressPage : IPage
 {
     private IArchiveEntry entry;
     
     public SharpCompressPage(IArchiveEntry iae)
     {
         entry = iae;
     }
     
     public Texture2D PageTexture
     {
         get 
         {
             if (_pageTexture == null)
             {
                 _pageTexture = new Texture2D(1, 1);
                 _pageTexture.LoadImage(ExtractBytes());
             }
 
             return _pageTexture;
         }
     }
     private Texture2D _pageTexture = null;

     private byte[] ExtractBytes()
     {
         byte[] result;
         MemoryStream output = null;
         try
         {
             output = new MemoryStream();
             entry.WriteTo(output);
             output.Position = 0;
             result = output.ToArray();
         }
         finally
         {
             if(output != null)
                 output.Dispose();
         }
 
         return result;
     }
 }

 
Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

3 Replies

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by robert_d · Jun 02, 2012 at 07:36 PM

The problem was that I messed something in Project Quality Settings, resetting them repaired this problem

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by alpaca of zion · May 12, 2012 at 09:28 PM

Make sure your images are in powers of two.

http://unity3d.com/support/documentation/Manual/Textures.html#texturesizes

If the image isn't in a power of 2 it has to be resized for mobile GPUs which looses quality.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by robert_d · May 12, 2012 at 10:21 PM

I can't control the size of the images, as I wrote those are comic book pages. How can I resize the texture?

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image alpaca of zion · May 12, 2012 at 10:41 PM 0
Share

You would need to resize them using a separate program like Photoshop or Paint.net. You may be running into a separate issue of the image being scaled for the screen. Getting a pixel perfect representation on an Android device may be impossible because of the differences in screen resolutions.

avatar image Drakestar · May 13, 2012 at 07:13 AM 0
Share

You can also use the Texture2D class to change the dimensions at runtime to make each image power-of-two. It has various Get/SetPixel functions that you can use to copy the original texture into a new POT texture.

Fighting the hardware is like fighting city hall - you'll never win. That assumes that the blurriness actual does come from non-POT textures, btw - it's is a good theory, but you need to verify that. It could also be that the engine picks a lower mipmap for whatever reason, and a myriad of other weird circumstances.

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

how to make a custom keyboard for your phone 0 Answers

Download Image to a new album (Android) 0 Answers

Printing from an android device to wireless printer -1 Answers

How can I send mail with images on Android? 0 Answers

how to save compressed image to gallery on Android ? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges