Need help with image resizing

Hi all

I downloaded an image from a URL and I want to display on my BB screen.  I want to get the image resized before displaying on the screen. I wrote the code, but it is cropped horizontally and vertically.  How can I get the image resized by preserving its quality? I want the new width of my image also as (screen width - 20) / 3 and height as something like original image height / 3  I post my code here

public static Bitmap resizeImage(Bitmap originalImage, int newWidth, int newHeight) {
        Bitmap newImage = new Bitmap(newWidth, newHeight);
        originalImage.scaleInto(newImage, Bitmap.FILTER_BILINEAR, Bitmap.SCALE_TO_FILL);
        return newImage;
    }

Thank you and best regards.

Replace Bitmap.SCALE_TO_FILL by Bitmap.SCALE_STRETCH solved the problem.

Thank you.

Tags: BlackBerry Developers

Similar Questions

  • Need help with image fusion

    Hello

    Before I get to my question, I want to give you a glimpse of the project I'm working on and the aspects that I need help. For a school project, a customer, 94Fifty asked us to create an advertisement that depicts their basketball and could be used in advertising online and in magazines. The 94Fifty of basketball is the world's first "smart ball." It can count how many times you dribbling, the arc of your shot, release time it takes for you shoot, etc. To use the ball, you need an Apple product that can download the application 94Fifty on the App Store, so that this project is done as a collaboration with the company 94Fifty and Apple.

    For my ad, to really capture the idea of being the first smart ball, 94Fifty ball I wanted to mix an image of the texture of the ball of 94Fifty, with the shape and details of a brain, with the slogan being, "A ball that is as smart as you." I have my design buried on, but I'm not sure how to combine the image of the brain with ball should I use layers? How can I remove the pink color of the brain and replace it with the ball while keeping the shape of the brain and the lines creased the brain? Any help and technical that you can give would be greatly appreciated.

    Here are two pictures that I'm trying to mix.

    8376271918_cf0b1b5c4f_o.jpg94fifty ball.png

    I would also try and keep the logo of 94Fifty which is on the ball in the mixed picture.

    Please do not confuse this for to ask me someone to do it for me, it's the exact opposite of what I want, I just need help with what to do.

    Here is a fairly simple method:

    First of all, level of basketball for the type to be horizontal. (Also correct the values of white light - burn at the top left and bottom top right.)

    Mask on white background of the brain and turn the image to 0% of saturation.

    Put the brain on basketball on its own layer. Make the overlay blend mode.

    Using free transform, reshape the brain is greater (rounder), like the basketball, with a visible margin around the edge of the ball.

    -Now, you have a brain in a basketball, but the brain is a bit too subtle.

    Duplicate the layer of brain as many times as you need to get the good contrast (I've duped the layer of brain three times, for a total of four layers of brain).

    You will probably find that you need to use the levels adjustment layers or curves on each layer of the brain, for finer value adjustments. Make sure that each adjustment layer affects only the layer directly below.

  • Need help with Image Processor

    Hello

    I have a lot of pictures, that I need to resize to a Web site. These images are all different sizes, 250 x 400 (h) to 200 x 800 (h). I need it to fit in a Web of 246 x 327, in their original proportions, regardless of white space.

    Does anyone know if this is possible? So far all my results have failed and image processor seems to just resize proportionally up to a maximum of 246 x 327, so nothing is that the EXACT size, but all the images will be adapted now integrate 246 x 327. I don't know what to do now.

    Any help is greatly appreciated.

    -Tim

    You can do this with a script.

    Save the code in the settings presets/scripts as filename.jsx, then you can include the script in action. Use "Insert Menu Item' in the menu drop-down action palette and select file - Scripts - select the script.

    function main(){
    if(!documents.length) return;
    var doc = activeDocument;
    var White = new SolidColor();
    White.rgb.hexValue = 'ffffff';
    // target size =  246x327
    FitImage(240, 321 ); //width - height change to suit
    app.backgroundColor = White;
    doc.resizeCanvas(new UnitValue(246,"px"), new UnitValue(327,"px"), AnchorPosition.MIDDLECENTER);
    }
    main();
    function FitImage( inWidth, inHeight ) {
     var desc = new ActionDescriptor();
     var unitPixels = charIDToTypeID( '#Pxl' );
     desc.putUnitDouble( charIDToTypeID( 'Wdth' ), unitPixels, inWidth );
     desc.putUnitDouble( charIDToTypeID( 'Hght' ), unitPixels, inHeight );
     var runtimeEventID = stringIDToTypeID( "3caa3434-cb67-11d1-bc43-0060b0a13dc4" );
     executeAction( runtimeEventID, desc, DialogModes.NO );
    };
    

    Edit: -.

    You need not even the script! as the size is not dependent on the direction, so after the Image ride you can use Image - size canvas in your action.

  • Need help with image slideshow quality full-screen

    I'm looking to display pictures with slide show full-screen. The images I add are very large, more than 5000 wide. When I write the site images maintain their quality while others lose it look like shit. Why would this be and how can I solve this problem. I tried to resize the 2560 x 1707 muse done and then add them. This does not change the final result of poor quality.

    Go to the components Panel and locate the image you want to use in the original format. Right-click on the image and chose 'largest import size. "

    See if that helps to maintain the quality of this image, as Muse does not resize/interpolate this image for you.

    See you soon,.

    Vikas

  • Need help with Image map

    Hey everyone I hope that someone can help me here. What I'm trying to do is create a card flipping immage, if possible. Essentially, I have a card with different routes Charter on it, and I would like to be able to move the mouse on a single track, highlight it in red and then be able to click it and a link to another page. How is this achieved? There are several roads, and they are not distributed between sectors that I could crop and use as individual images. If it doesn't, maybe if someone could explain to me how having a side buttons together to highlight the road and allow me to click and a link to another page. I understand how to work the images hover and such, but multiple transfers on a single image is confusing to me. If someone could answer this, I would be EXTREMELY grateful. Thanks in advance and ask if you need any clarification with my problem to help solve it.

    Genii

    Sorry... He answered myself

  • Need help with Images associated with berries

    `

    I'm not sure if this is possible, as I am not a common programmer, but I have a question.

    I have a table that generates a random word in a text box, then a second table that generates another word at random in a different text box. What I want is for when a certain word off number one table is generated, a certain image is displayed with it. Here is the code:

    var FirstChoice:Array = ['this', 'Do'];

    var SecondOption:Array = ["during this operation', 'while doing this'];

    generate_btn.addEventListener (MouseEvent.CLICK, getTask);

    function getTask(event:MouseEvent):void {}

    var randomChoice:Number = Math.floor (Math.random () * firstChoice.length);

    var randomTask:Number = Math.floor (Math.random () * secondOption.length);

    First_Thing.text = exerciseChoice [randomChoice];

    Second_Thing.text = homeTask [randomTask];

    }

    For example, when I click the button and the first table generates "Do this", I want a chart specific to appear with him. Similarly, if 'this' generates, I want a different graphic to appear specifically associated with this variable.


    I hope that this is possible :/ I'm puzzled! I asked for help on StackOverflow; However, their advice did not work. Of course, I only got a response, so I hope that people here can help me out!

    var FirstChoice:Array = ['this', 'Do'];

    var SecondOption:Array = ["during this operation', 'while doing this'];

    var imageA:Array = (mc1, mc2);

    var currentImage:MovieClip

    function getTask(event:MouseEvent):void {}

    var randomChoice:Number = Math.floor (Math.random () * firstChoice.length);

    var randomTask:Number = Math.floor (Math.random () * secondOption.length);

    First_Thing.text = exerciseChoice [randomChoice];

    Second_Thing.text = homeTask [randomTask];

    {if (currentImage)}

    currentImage.visible = false;

    }

    currentImage = UIImage [randomChoice];

    currentImage.visible = true;

    }

  • need help with image download and preview screen

    Hi guys,.

    I am trying to download image and then view Preview, but when the download form submits to the placeholder image page itself is not updated his source and shows the same image as before.

    4.jpg image already exists.

    I download with nameConflict = "overwrite".

    Download form on the same page, so the page charging points

    In IE image placeholder does not appear the new image, but shows the old one until I have updated the page with F5 and return information, however if checked, image in the file is already different.

    In Firefox, sometimes it works and the image refreshes, sometimes not.

    any help would be greatly appreciated!

    see you soon,

    Simon

    Hi Simon,.

    In this case, you can follow this tutorial

    http://www.communitymx.com/content/article.cfm?cid=71EDA

    HTH

  • Need help with images of different sizes being loaded from a container of centering

    Stop();

    mainArea_mc.visible = false;

    home_btn.addEventListener (MouseEvent.CLICK, function () {Stop ("model home")});

    var totalImages:int = 0;

    var imageDirectory: String = "";

    var currentImage:int = 1;

    var filePrefix: String = "";

    var loader1: Loader = new Loader(); 2 Chargers, so we can fade a picture on top of the other

    var loader2: Loader = new Loader();

    pic_mc. AddChild (loader1);

    pic_mc. AddChild (loader2);

    loader1. Name = "loader1."

    loader2. Name = "loader2";

    loader1.contentLoaderInfo.addEventListener (Event.COMPLETE, resizeFadeImage);

    loader2.contentLoaderInfo.addEventListener (Event.COMPLETE, resizeFadeImage);

    info_mc.title_txt. AutoSize = TextFieldAutoSize.LEFT;

    If (presModeSlides) / / slides Viewer vars configuration

    {

    totalImages = slides [currentSlideNumber] .numSlides

    imageDirectory = "Data/slides/"+slides[currentSlideNumber].directory+"/";

    filePrefix = "slide";

    info_mc.title_txt. Text = .title slides [currentSlideNumber]

    info_mc.speaker_txt. Text = .speaker slides [currentSlideNumber]

    info_mc.university_txt. Text = .university of slides [currentSlideNumber]

    }

    else / / Setup Photo viewer vars

    {

    totalImages = 233;

    imageDirectory = "data/images /";

    filePrefix = "image";

    info_mc.title_txt. Text = "user International BioPlex® 2200 3 meeting;

    info_mc.speaker_txt. Text = "Images";

    info_mc.university_txt. Text = "";

    }

    info_mc.speaker_txt.y += info_mc.title_txt.height;  Position sublines so that they are directly under the title

    info_mc.university_txt.y += info_mc.title_txt.height;

    leftArrow_btn.addEventListener (MouseEvent.CLICK, prevImage);

    rightArrow_btn.addEventListener (MouseEvent.CLICK, nextImage);

    showImage (currentImage)

    function showImage(num:int)

    {

    If (pic_mc.getChildIndex (loader1) > pic_mc.getChildIndex (loader2)) / / set the jpg file in what container is on top for the moment

    {

    loader1. Load (new URLRequest (imageDirectory + filePrefix + currentImage + '.jpg'));

    }

    on the other

    {

    loader2. Load (new URLRequest (imageDirectory + filePrefix + currentImage + '.jpg'));

    }

    }

    function resizeFadeImage(e:Event)

    {

    e.currentTarget.loader.alpha = 0;

    Tweener.addTween (e.currentTarget.loader, {alpha: 1, time: 0.4, onComplete: removeOtherImage, onCompleteParams:[e.currentTarget.loader]});})

    e.currentTarget.loader.scaleX = 0.75;

    e.currentTarget.loader.scaleY = 0.75;

    var bitMap: Bitmap = Bitmap (e.currentTarget.loader.content);

    bitMap.smoothing = true;

    }

    function removeOtherImage(l:Loader)

    {

    If (l.name is "loader1")

    {

    pic_mc. SetChildIndex(loader1,0);

    If (loader2.content! = null)

    {

    If (loader2.content is Bitmap)

    {

    (loader2.content as Bitmap).bitmapData.dispose ();

    }

    }

    }

    on the other

    {

    pic_mc. SetChildIndex(loader2,0);

    If (loader1.content! = null)

    {

    If (loader1.content is Bitmap)

    {

    (loader1.content as Bitmap).bitmapData.dispose ();

    }

    }

    }

    }

    function nextImage(e:Event)

    {

    If ((!)) Tweener.isTweening (loader1)) & & (!) Tweener.isTweening (loader2)))

    {

    If (currentImage < totalImages)

    {

    currentImage ++;

    }

    on the other

    {

    currentImage = 1;

    }

    showImage (currentImage);

    }

    }

    function prevImage(e:Event)

    {

    If ((!)) Tweener.isTweening (loader1)) & & (!) Tweener.isTweening (loader2)))

    {

    If (currentImage > 1)

    {

    -currentImage;

    }

    on the other

    {

    currentImage = totalImages;

    }

    showImage (currentImage);

    }

    }

    :

    function resizeFadeImage(e:Event)

    {

    e.currentTarget.loader.alpha = 0;

    Tweener.addTween (e.currentTarget.loader, {alpha: 1, time: 0.4, onComplete: removeOtherImage, onCompleteParams:[e.currentTarget.loader]});})

    e.currentTarget.loader.scaleX = 0.75;

    e.currentTarget.loader.scaleY = 0.75;

    e.currentTarget.loader.x = (stage.stageWidth-e.currentTarget.loader.width)/2;

    e.currentTarget.loader.y = (stage.stageHeight-e.currentTarget.loader.height)/2;

    var bitMap: Bitmap = Bitmap (e.currentTarget.loader.content);

    bitMap.smoothing = true;

    }

  • Newbie needs help with Images

    Hi, I'm a newbie to flex and I have a question very quick and basic images. I try to have a simple image and when clicked on it, it turns into to another image, and if you click it again it goes back to the original.  To my knowledge, the first part of the MXML code works as:

    < mx:Image id = source = "Old.jpg"MyImage"" click = "myImage.source ='New.jpg" "/ >"

    So the first part works, but how can I do so that when I click on the new image the source goes back to the original image?  Thanks in advance.

    Use a function and a global var like this in a script block:

    private var bSwap:Boolean;
    
    private function imgClick():void{
         if (bSwap){
              myImage.source="Old.jpg";
              bSwap=false;
    }else
    {
         myImage.source="New.jpg"
         bSwap=true;
    
    }
    
    }
    
  • Hello, I need help with my photoshop, rececently the majority of my family disappeared merger options and I cant access AVC and other options ive tried reset preferences and it seems to come back but when I add an image and try add text again

    Hello, I need help with my photoshop, the majority of my family rececently disappeared options fusion and I can't access strokes and other options ive tried to reset the settings of preference and he seems to come back but when I add an image and you try to add text again, they'll only options I have are drop shadow , gradient, Chromakey, shine of satin overlay, inner (I use photoshop cc 2015) Please help, my Skype contact options are: RoblivionM8 and email:[email protected]

    Thanks for your time

    Your first screenshot shows the layer style dialog where not all types of effects are indicated on the left. Bottom left of the dialog box, you see a small icon fx with a menu arrow drop-down. Use drop down the menu and make sure all you click on show all effects or restore the default list. I don't know what you're trying the shoe on the second screen capture.

  • Need help with moving around images

    I need help with moving images and images around the dreamweaver document window. My brother gave me his computer witch a dreamweaver MX (it is in Irag) so I can start building my own construction sites. I went to borders and bought a book on dreamweaver MX. Here's where I'm having a problem with: when ever I bring an image in the document window, I can't move the image around the document window. The book says "place the insertion point where you want the image to appear" but there is no insertion point. There is just a straight line as if I am trying to type something. It's almost as if I'm in microsoft word. If I take the mouse on the image, and then left click and try to drag the image to the location I want, it does not move. Can someone please help me with this problem. Thanks Jical

    Thank you for the answer to my question. This was really helpful.
    Jical

  • Need help with sizing and save files in batches

    Hi need help with a project.

    I have thousands of vector files that I need size of 350px X 350px, and then place it on a work plan x 600px-600px.

    Then I need to save it to the web as a PNG with a transparent background.

    Could I do a script for? or is there another way to do it in batches?

    I wouldn't have to open them one by one and resize the work plan then the image and save it one by one as that would take forever.

    Any help some suggestions would be greatly appreciated.

    ID do as a series of actions photoshop if the end result is png,

    pro image processor can help you make automatically, if you must resize batch additional... >

    https://sourceforge.NET/projects/PS-scripts/files/image%20Processor%20PRO/v3_2%20betas/

    I think that your work can run in a few steps, but for simplicity, I would like to start / test with a new photoshop action recording

    Open a file, change the size of the image to 350 x 350

    Change the canvas size,

    then save under...

  • I need help with an installation failure to interpret and troubleshoot a Setup log.

    Background: A few years ago, many editors of cinema used Final Cut Pro 6 (also contained in Final Cut Studio 2) for their editing projects.  Shared Apple Final Cut X uses a different format that is not compatible with FCP6.  Sometimes, these editors are called to work on a few historical projects that have been published in FCP6 and need this version to run now.

    Starting with OS X Lion, FCP6 would install not in Lion and thereafter.

    According research by Jeremy Johnston as noted on his blog, he discovered that Apple has inserted a file in the folder CoreServices in the Library folder of the system folder that causes versions the version Final Cut Pro X (and other older Apple programs in the same situation) do not settle.  He suggested changes to this file that would seek to prevent interfering with the installation of FCP6 in Lion, many users of final cut PRO 6 were successful in their efforts to install in Lion and work with it.

    Later in a discussion update on installing FCP6 in Mavericks, HawaiianHippie determined that the simplest way to perform the installation of FCP6 was simply copy this file and remove it from the system folder, install FCP6 and then restore the copied file:

    https://discussions.Apple.com/message/26309669#26309669

    I used this method with success to install FCS2 in Yosemite:

    [click on images to enlarge]

    However, in my attempts to install FCS2 in El Capitan, it fails in the last 5% to install the first DVD:

    First of all, I need advice on how to display an extremely large Setup log in this thread (on MacRumors, it is a method to insert a 'code' in a small box that can be the object of a scrollbar if necessary to read all along).  I am unable to find such a method to post here.

    Then once approved, I need help to determine which component is causing the installation to fail and perhaps this element can be omitted from the installation:

    If this element is not required, then maybe FCP6 can be installed successfully without it.  And if that omitted element is necessary, perhaps a manual method to install it can be determined by pacifists.

    It is my goal to help those who need to install and use FCP6 on their new Macs running El Capitan.

    Here is the post on MacRumors with pre-installed Setup log:

    http://forums.MacRumors.com/threads/i-need-help-with-an-installation-failure-to-interpret-and-troubleshoot-an-Installer-log.1954786/#post-22541389

  • Need help with windows defender. all my files folders pictures everythiing disappeared and I find myself with this black screen and it is not all good: o)

    Need help with windows defender. all my files folders pictures everythiing disappeared and I find myself with this black screen and it is not all good: o)

    I don't know why vista windows no longer charge, or when the files and folders disappeared

    How Windows Defender is on this problem?

    Follow these steps to try to solve your problems of boot.

     

     

    Restore point:

    Try typing F8 at startup and in the list of Boot selections, select Mode safe using ARROW top to go there > and then press ENTER.

    Try a restore of the system once, to choose a Restore Point prior to your problem...

    Click Start > programs > Accessories > system tools > system restore > choose another time > next > etc.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

     

    If restore work not and you do not have a Vista DVD from Microsoft, do a repair disc to do a Startup Repair:

    Download the ISO on the link provided and make a record of repair time it starts.

    Go to your Bios/Setup, or the Boot Menu at startup and change the Boot order to make the DVD/CD drive 1st in the boot order, then reboot with the disk in the drive.

    At the startup/power on you should see at the bottom of the screen either F2 or DELETE, go to Setup/Bios or F12 for the Boot Menu.

    When you have changed that, insert the Bootable disk you did in the drive and reboot.

    http://www.bleepingcomputer.com/tutorials/tutorial148.html

    Link above shows what the process looks like and a manual, it load the repair options.

    NeoSmart containing the content of the Windows Vista DVD 'Recovery Centre', as we refer to him. It cannot be used to install or reinstall Windows Vista, and is just a Windows PE interface to recovering your PC. Technically, we could re-create this installation with downloadable media media freely from Microsoft (namely the Microsoft WAIK, several gigabyte download); but it is pretty darn decent of Microsoft to present Windows users who might not be able to create such a thing on their own.

    Read all the info on the website on how to create and use:

    http://NeoSmart.net/blog/2008/Windows-Vista-recovery-disc-download/

    ISO Burner:http://www.snapfiles.com/get/active-isoburner.html

    It's a very good Vista startup repair disk.

    You can do a system restart tool, system, etc it restore.

    It is NOT a disc of resettlement.

    And the 32-bit is what normally comes on a computer, unless 64-bit.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Data recovery:

    1. slave of your hard drive in another computer and read/save your data out there.

    2. put your Hard drive in a USB hard drive case, plug it into another computer and read/save from there.

    3 Alternatively, use Knoppix Live CD to recover data:

    http://www.Knopper.NET/Knoppix/index-en.html

    Download/save the file Knoppix Live CD ISO above.

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    http://isorecorder.alexfeinman.com/isorecorder.htm

    Download the Vista software from the link above.

    After installing above ISO burning software, right click on the Knoppix ISO file > copy the Image to a CD.

    Knoppix is not installed on your PC; use only the resources of your PC, RAM, graphics etc.

    Change the boot order in YOUR computer/laptop to the CD/DVD Drive 1st in the boot order.

    Plug a Flash Drive/Memory Stick, BOOT with the Live CD, and you should be able to read the hard drive.

    When the desktop loads, you will see at least two drive hard icons on the desktop (one for your hard drive) and one for the USB key.

    Click on the icons of hard drive to open and to understand which drive is which.

    Click the icon for the USB drive and click on "Actions > Change the read/write mode" so you can write to disk (it is read-only by default for security reasons).

    Now to find the files you want to back up, just drag and drop them on the USB. When you're done, shut down the system and remove the USB key.

    See you soon.

    Mick Murphy - Microsoft partner

  • Need help with mobile layout

    Hello. Need help with my layout sensitive, using straight lines only html5 and css3 that I can understand and explain a novice level please - without any restart. Desktop and mobile are in a single html doc. The desktop version is 'ok '.

    current version (6_2)

    Try to match these mobile Office layouts

    On the mobile version:

    -Impossible to get the buttons nav blocks, vertical text button Align, and align the image of the product (square pictures) to the Center. (margin: auto; does not work)

    I used heights in the header because I'll have code for desktop, mobile and tablet in the CSS so it changes (and do not know how to support better). Also need to Add a link to the logo image background in header.

    Thanks in advance!

    TheOriginal150mph wrote:

    Hello. Need help with my layout sensitive, using straight lines only html5 and css3 that I can understand and explain a novice level please - without any restart. Desktop and mobile are in a single html doc. The desktop version is 'ok '.

    current version (6_2)

    Try to match thesemobile Officelayouts     

    On the mobile version:

    -Impossible to get the buttons nav blocks, vertical text button Align, and align the image of the product (square pictures) to the Center. (margin: auto; does not work)

    Commenting on just a habit of property changing the css if you have defined it for the desktop version. Your nav elements are not vertically Center because you have a bottom padding set on them for the office, there are only changes for mobile in your css media query.

    .main-nav a {}

    display: block;

    text-decoration: none;

    / * padding-bottom: 15px;   */

    Padding: 12px 0;

    }

    Change the properties for the .product-images for mobile boxes: you have float attached to them for the desktop version and which cascade down to the mobile version, unless you change in the media query:

    .product-image {}

    float: none;

    Width: 50%;

    margin: 0 auto 20px auto;

    }

    As I mentioned in one of my posts related to your project, you will probably have to make your product images a bit larger. They fill the area once they form a column to width of 768px screen or you could resist transform them to one column until a little more by using a media query extra set at a narrow screen width to evoke this action

Maybe you are looking for