Question about image scaling height

Hi all

I know that there are a ton of posts on this topic, but I have not really found one that is clear on the problem I encounter.

Basically I have a PNG image that I want to change so that the width of the image corresponds to the width of the screen.  So, I want the height of the image to be adjusted automatically in order to preserve the proportions of the image.  Currently, I am doing this:

Bitmap b = Bitmap.getBitmapResource(image);

Bitmap scaled = new Bitmap(Display.getWidth(), ???);
b.scaleInto(scaled, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FIT);

BitmapField bf = new BitmapField(scaled);

But with this method, I have to set the height of the sized image.  This is not good, as I don't know what should be the height after the image has been resized (and kept proportions).

Anyone know how I can determine the correct height of the image?

Thank you.

If you can get the height and width of the image, then use the ratios.

UX = initial width, OH is original height, NW is the new width, NH = new height.

(NW * OH) / OW = NH

Tags: BlackBerry Developers

Similar Questions

  • Question about image slideshow (like file mac preview)

    Hello! Ι have a question about Adobe Edge.is it is possible to create a slide show preview of mac file? I mean smthg like this https://www.YouTube.com/watch?v=Q727LqDIZKM

    Hi, TasisGrafix2-

    Animate edge does not support the css3d in native mode, but you can use a third party such as edgehero.js library to do this work.

    http://www.edgehero.com/edgeherojs.html

    Good luck!

    -Elaine

  • Question about images with Bootstrap galleries

    I watched the tutorial, I might add is very nice:

    Bootstrap Modal + Carousel Gallery - http://alt-web.com/

    And a number of questions:

    1. on the 'DEMO', there are 6 images. All images must be shown or may be just 1 image that when you click on the modal will load containing the remaining images?

    2. If you want to add more than 1 Gallery, do I need to recreate the full tutorial for each gallery? I have 5 different galleries.

    Thank you

    John

    jodmcc49 wrote:

    I watched the tutorial, I might add is very nice:

    Bootstrap Modal + Carousel Gallery - http://alt-web.com/

    Thank you to say, John.   I appreciate it.

    1. on the 'DEMO', there are 6 images. All images must be shown or may be just 1 image that when you click on the modal will load containing the remaining images?

    You can call the modal window to open a single image or a button, if that's what you want.

    jodmcc49 wrote:

    2. If you want to add more than 1 Gallery, do I need to recreate the full tutorial for each gallery? I have 5 different galleries.

    The way I structured this tutorial in particular, you should be 5 modal windows with a unique ID.

    • myModal1 - contains carousel1
    • myModal2 - contains carousel2
    • myModal3 - contains carousel3
    • etc...

    If you are good with AJAX/jQuery, you could call the Gallery carousel appropriate in a single Modal with GetElementByID instruction component.  But it's another tutorial.

    Nancy O.

  • question about images

    Hello

    I have two images. I when emphasis has come to this area, he shows me a picture and if the missing accent then it shows me the other image, how it is possible.

    It is simple using onfocus() and onunfocus()

  • Questions about images placed the size / ID CC

    When I place a file of bitmap (file-> Place) they sometimes get way bigger than their original size, sometimes so big that I'm not able to reduce it even once, not even by changing the percentage of size. I just remove it and try to re-place. I don't know why this happens so randomly because when I place multiple images in the same process only some of them go on size while others are smaller than the original size. What happens with Jpeg and PNG formats.

    Can someone tell me what is happening here?

    When you Place your image click and drag. You can also create a frame and place the image, keep the frame selected and then choose object > fitting > and select one of the options of editing.

  • Question about image editing

    Hi, I'm just wondering if anyone can tell me how to put Photoshop as my default image editing program when I want to edit a picture from an InDesign document. I'm having a problem with InDesign open the image in the preview instead of Photoshop, when I option-click on a photo.

    I see that there is a pull down menu links (the command "Edit with") where you can choose the program you want to use, but that doesn't seem to work for a specific image. I wonder if there is a way to tell InDesign to always use Photoshop when I option-click on a picture? Thanks in advance.

    As a way to explore, what happens in the viewfinder when you double-click on the filename of the image, or select and press command & O or file > open?

    If the preview opens in each of these cases, it is not a parameter of the InDesign You ' r which need to change. Instead, get info for the image in the viewfinder and set the "Open with" context menu in Photoshop. and select any title change of "use this application to open all documents like this. You will need to do this for each type of image such as tiff, psd, eps, etc..

    Al

  • Question about images and URLS

    I'm new to Captivate and made a quiz on the history of the County is my University.  My manager wants me to add URLS and images for the quiz slides, but it won't let me.  I tried to do it on the random slide and try to copy a button I made on another page but that didn't work.

    I am using Captivate 3.

    So I need help answering:

    1. How can I add a button or a link to an external URL in Captivate on a quiz slide?

    2. How can I add an image to a quiz slide?

    I'd appreciate any help.

    Thank you!

    Hello

    I don't know why this would happen. I've tested this in my Captivate 3 and it seemed to work just dandy. I also tested more away after reading this to ensure that I was trying my best to duplicate your situation. And unfortunately I can not.

    You are able to view the Captivate file for me to look at? You can use www.YouSendIt.com. I'd be happy to see if I can make heads or tails of what might happen to you.

    My E-Mail address is in my profile of forum.

    See you soon... Rick

  • Questions about the automatic height and display on Firefox

    I'm working on a website and I homepage (with numbers).

    (1) the Interior wrapper is a gradient and has a height of repetition and automatic. They like to look him up and black bar at the bottom of the screen with the red bar. The problem is that it is set to repeat itself so if someone changes the size of the font will display exactly the same thing. How to look the same? All ideas welcome.

    (2) in addition, when you hit more police in the area of text at the bottom of the rounded corners is adopted at a max height, but the text flows into the area, I can prevent this?

    (3) in addition, if you look at it in firefox, it has a white bar at the top. I don't know that I have a bit of coding there that is incorrrect and the cause, any ideas?

    Thanks for all the ideas, attached is my link to the page. Please be nice because this is my second web site.

    http://www.lotusvalleydesigns.com/meixnerconstruction/safety.html

    .oO (new dreamweaver)

    > Thank you very much for the helpful tips. I am a beginner and
    > enjoy all the tips I can get. I'll give these changes a
    > go and see where I end up. I'm sure that I'll be back!

    You are welcome.

    And just ask what you want to know.

    Micha

  • The specific question about the placement of an image into text.

    Hello, I had a question about the placement of an image into text.

    I did the contours to create text to place the image inside. My text is 5 words and two lines inside the box.

    When I do create contours he gives me 2 transparent route separate layers for the top and the bottom line.

    How will I be able to do that in a single layer of compound to place image that expands to the two lines?

    First of all, there are two ways of describing the type. The default value creates anchored objects. You want a separate object, so hold down the Option/Alt key when you create outlines. Drag the new contours to separate the text block.

    It is useful to open the layers panel and view the contents of the layer. You have created a group which consists of two transparent traces. In the layers panel, expand the layer so you can see the structure. Shift-select the two transparent traces. (Make sure that the group is not selected.)

    Then choose object > tracks > make a compound path. This makes the two transparent tracks into one. Then, you can place or paste into the single compound path.

  • Re: Several questions about the recovery of the Satellite L750 features

    I have several questions about the recovery of Satellite L750 features available to it. Any help and answers would be useful.

    (1) when I started the laptop first, he asked me to create a recovery CD incase I need to reinstall the operating system. But he also said that he built in the recovery partition, so therefore, I have to make a recovery cd or not?

    (2) will be the recovery CD is exactly the same as the recovery on the system partition?

    (3) is the partion of CD or recovery includes all the integrated software pre-installed with the laptop?

    (4) also in the device manage management it shows watch partion recovery but it is empty, is it true?

    (5) in the second partition (drive D) system, he has a record with what looks like the recovery of files and folders. Is it safe to move/remove it?

    Hello

    I'll try to provide answers:
    1 - to ensure that everything works perfectly you don t need these discs, but if something goes wrong with the HARD drive you will not be able to do anything. When you have the recovery DVDs, you will still be able to install the recovery image and once again the factory settings. So my advice to you is: create these discs as soon as possible. Use only on DVD-R media and buy products of high quality (TDK or Verbatim).
    2 - Yes.
    3 - Yes.
    4 - No. Don t be confused with this.
    5. in a first time create restore DVD, and later you can do what you want. I put t know which files mean you but don t touch anything before that of the recovery disks to be created.

    In the past, many people have been experimenting with the structure of HARD drive and partitions and later was surprised when installing disk recovery HARD has been damaged. Don t make the same mistake.

    If you have any other questions you are welcome.

  • A few questions about Toshiab reocvery disk for Satellite P300-133

    Hello guys,.
    I had a few questions about unpleasant surprises of recovery:

    (* 1) * I just make recovery DVD using Toshiba Recovery Disk Creator and he asked initially for 2 DVDs - but when one has been done it does not require a second blank DVD. Is it possible all the Windows Vista system files to write on 1 DVD?

    (* 2) * if I could reinstall Windows Vista using recovery of HARD drive option (by pressing F8) without using the recovery DVD?

    (* 3) * HARD drive partitions that will be formatted (just system C: or C: and E :) using HARD drive recovery?

    (* 4) * what is DVD - Image of the hard drives or the installation of Vista recovery files?

    Its pretty bad idea to not include BONES on DVD when I paid for it.
    Thanks for all the Toshiba problems :(

    1. I think the recovery disk creator means 2 CDs. I also have a Portege M700 with Windows Vista and a DVD. I got it and after that, I have a clean install of Vista with all the drivers and tools of Toshiba. Nothing is missing.

    2. Yes, you can reinstall Vista using recovery of HARD drive option when you press F8 at startup. You don't need the recovery DVDs, but you should create a when your HARD drive get some errors or something else. If you need a new recovery DVDs, you paid for one.

    3 HARD drive and complete partitions will be formatted, so backup your data first on a DVD disk external DRIVE, USB stick or something else.
    After the reinstallation, you have factory settings.

    4. the recovery DVDs is an image of the HARD disk on the factory settings. If you perform a recovery, there are all the drivers and tools are already installed. Of course, on the disk are files of installations of Vista, but you can use this DVD on your Satellite P300. The disc cannot be used on another Satellite or on a PC.

    If you have any other questions, take a look in the user manual. There are a number in the formations of the recovery. It s in Chapter 3.

  • question about cleaning the sensor of the A57

    Dear community of Sony,

    I have several questions about the cleaning of the sensor of the A57.

    Recently, I noticed several dark specs appearing on images when shooting at low opening (F20, F22), especially when there are high for them (like the sky in a landscape photo) contrast. To my knowledge, I've categorized as possible of dust on the sensor. I have read the section of the manual about cleaning the sensor and followed the procedure. However, the problem remained. I have previous experience with cleaning of the more resistant the probe of a Sony NEX dust particles, so I applied it to the A57. I used the specialized sensor cleaning tools combining two parts kit - wet and dry. Noted little dust on translucent mirror as well, so I cleaned up afterwards. Later, I considered this mirror could have some specialized coatings.

    So my first question is: should I have done some permanent damage the mirror or the sensors? Currently, the camera works OK, although some features of dust still remain. It seems that I had pushed some of them to the edges of the sensor.

    I'm not so happy with the tool that I used. I'm thinking about this one for a more thorough cleaning:

    http://www.digitaltoyshop.co.UK/Eyelead_sensor_cleaning_kit_SCK-1_Sony_Alpha_A57_t2836_6789

    It is marketed as a tool for A57. Should I use it?

    Thank you in advance?

    Best regards Angel Marinov

    PS: I'm really happy with my Sony A57 and the NEX. They made me a fan of Sony. So, I want to use this topic to also say thank you to the developers of Sony.

    Hello Angel!

    Read the following steps carefully and let us know if you have any other questions.

  • stupid question about UAC

    OK, it's a REALLY stupid question about UAC.

    I have several icons on my desktop. Some of them are games that must be run as administrator in XP compatibility mode.

    I rarely accidentally tried to open the icon, particularly if you use the keyboard to choose what I want.

    Is there a reason if I accidentally open a game that pushes me in height DO NOT hit 'Cancel' if I didn't intend to play the game at the moment, but trying to open something else? Something like a process being left in suspense, memory leaks, or any other reason why I can't Abort to launch the application to the UAC prompt?

    Hey, Slick,

    Clicking Cancel will prevent the running total process if you do not have to worry about the still ongoing services for memory leaks or game, etc..
    I hope this helps.
  • INSPIRION 3543 - question about jack combo

    Hi, I have a question about a laptop Inspiron 3543. He installed the combo input jacks, and I need to use the line of input and output audio.

    Question 1: Is - it enough for me for this purpose a headphone splitter - 2 jack x ordinary?

    Question 2: Is this laptop allows you to adjust the entry on the line in mic?

    Sorry for the broken English, but I write with a translator: D

    dayer41
    Question 1: Is - it enough for me for this purpose a headphone splitter - 2 jack x ordinary?

    Hello. Jack combo on the Inspiron 15 3543 is intended to be used with standard stereo headphones, or with headphones (stereo headset with a built-in mono microphone).

    In theory, a dispatcher or an adapter with a plug out of SOCKET (tip, ring, ring, sleeve) can be used with a combo Jack. A plug from SOCKET looks like this:

    However, we have received many messages from people saying that the adapter did not work for them. Some people have posted and said that the adapter works for them.

    Note that the entry of a combo Jack is mono. There is no way to make it be a stereo input.

    dayer41
    Question 2: Is this laptop allows you to adjust the entry on the line in mic?

    You can set the input mic in sound properties volume (Control Panel > Sound). Open the properties of the sound, and then click the recording tab at the top. Right click on the Microphone. Click 'properties '. Click the tab at the top levels to find the sliders to adjust the volume of the mic input.

    It is similar to this image, except that you must click on 'Levels', not 'listen '.

  • Questions about using HomeScreen.setBackgroundImage, please!

    I am currently make an app when a user presses a button, should change the wallpaper on the homescreen to an image of my application. I know that I need to use HomeScreen.setBackgroundImage (String URL) for this, but I have some questions about its use, that I have not found on the forums of the knowledge base.

    (1) I use PNG images, I realized I may have to change them into JPG, is this true? If it is true, can I just use PNG images in the first place, as in, use them in my application and also as the wallpaper?

    (2) how can I find the URL of the chain of my images, I store them in the folder resource in Eclipse. The URL will be the same for the simulator tests as it will be for the device?

    (3) what I need to make the images of persistent to keep them as a background image or the api will do that automatically whenever I create a new wallpaper?

    I hope that these are simple answers for you pro out there, thanks in advance!

    For anyone who needs help with this topic, the following website has answered most of my questions:

    http://blog.vimviv.com/BlackBerry/display-information-BlackBerry-homescreen/

Maybe you are looking for