Solved

Image padding

Posted on 2011-02-28
6
386 Views
Last Modified: 2013-11-19
I am stuck on this very important part and which is ruining my system.

Presently to maintain the aspect ratio Android changes the image width and height of an image i.e it pads it to maintain the aspect ratio

How can I know how many lines of pixels were added. Is there an API, formula ?

The reason is that my application adds tags to an image with x, y information on another platform . When I open it on my ANdroid device the image resolution is changed, so my tags look out of place. If I know how android calculates this I can apply the same for the orientation of my tags and work around

Your help would be greatly appreciated..Thanks in advance
0
Comment
Question by:jbajaj
  • 2
  • 2
6 Comments
 
LVL 21

Accepted Solution

by:
oleggold earned 500 total points
Comment Utility
0
 
LVL 5

Expert Comment

by:UnConn
Comment Utility
I think you have two choices.

- Make your layout scale.  Do not put your tags in postitions relative to pixels as they can change between device screen sizes.  Android programing best practices state this too.  If you use a layout that scales then the layout should scale relative to the image.

- Use PS instead of PX.  PX uses pixels but PS uses the scaled resolution based on DPI.
0
 

Author Comment

by:jbajaj
Comment Utility
Hi oleggold,

  I didn't get any idea from http://www.codeweblog.com/stag/android-alchemy-formula-list/   site. Please
explain me how this site will help me. Or if you have any idea then please explain me.

Thank you.
0
 
LVL 5

Expert Comment

by:UnConn
Comment Utility
There is one more option and this is providing graphics for each version of the screen you will support, LDPI, MDPI, and HDPI.  This assumes you are running on 1.6 and above (minSdkVersion="4")
0
 

Author Closing Comment

by:jbajaj
Comment Utility
good
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

PaperPort 14.5 Patch 1 update is often not detected or downloaded automatically. This article provides direct download links to solve the problem for retail (non-bundled) versions of the Standard and Professional editions, as well as the Professiona…
If your app took Google’s lash recently, here are the 5 most likely reasons.
The goal of the tutorial is to teach the user how to make his/her own presets while editing so it is easier to edit there photos. Create a preset you like and copy that setting then save it in to your presets folder.
Not only does Prezi allow you to create non-linear presentations, it also makes it easy to apply transition animations between your frames. Learn how to apply a fade-in transition to select items and entire frames in this tutorial Select "Edit Path"…

763 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now