Resize the SD card image to fit screen

Hello

I've already learned how to read a bitmap file from the SD card with the following code:

public Bitmap getBitmapFromFile(String file){

    Bitmap b = null;
        try{
            FileConnection oInputFileConnection = (FileConnection)Connector.open(file, Connector.READ);
            InputStream oInputStream = null;

            if(oInputFileConnection.exists())
                oInputStream = oInputFileConnection.openInputStream();

            byte[] arrData = new byte[(int)oInputFileConnection.fileSize()];
            int nCode = oInputStream.read(arrData, 0, arrData.length);
            oInputStream.close();
            oInputFileConnection.close();

             b = Bitmap.createBitmapFromBytes(arrData, 0, -1, 1);
        }catch(Exception e){

        }
    return b;
}

Now I want to format this bitmap to the size 480x360px. How can I do?

I know what I can change with this

b = Bitmap.createBitmapFromBytes(arrData, 0, -1, 1);

but it is not so accurate.

Can someone help me?

just tried it out.

public class Utils {
    public static Bitmap resizeBitmap(Bitmap image, int width, int height)
    {   

        //Need an array (for RGB, with the size of original image)
        //
        int rgb[] = new int[image.getWidth()*image.getHeight()];

        //Get the RGB array of image into "rgb"
        //
        image.getARGB(rgb, 0, image.getWidth(), 0, 0, image.getWidth(), image.getHeight());

        //Call to our function and obtain RGB2
        //
        int rgb2[] = rescaleArray(rgb, image.getWidth(), image.getHeight(), width, height);

        //Create an image with that RGB array
        //
        Bitmap temp2 = new Bitmap(width, height);

        temp2.setARGB(rgb2, 0, width, 0, 0, width, height);

        return temp2;
    }
    private static int[] rescaleArray(int[] ini, int x, int y, int x2, int y2)
    {
        int out[] = new int[x2*y2];
        for (int yy = 0; yy < y2; yy++)
        {
            int dy = yy * y / y2;
            for (int xx = 0; xx < x2; xx++)
            {
                int dx = xx * x / x2;
                out[(x2 * yy) + xx] = ini[(x * dy) + dx];
            }
        }
        return out;
    }
}

Tags: BlackBerry Developers

Similar Questions

  • Why I can't change my script if I resize the application - ADOBE STORY - to fit all of the space on my screen, by clicking on the icon full screen? What did I miss? Thank you

    Why I can't change my script if I resize the application - ADOBE STORY - to fit all of the space on my screen, by clicking on the icon full screen? What did I miss? Thank you

    Sorry, but the web application from Adobe Story doesn't support editing mode full screen.

  • Toshiba Journe Scan: Cannot save a scanned in the media card image

    I got a scan for Christmas day.
    I can't save a scanned image to the media card, I tried both xd and sd cards.
    I know that they are achievable cards that I took the test photo with them.

    Can someone please help?

    Thanks for the comments dude!

  • HP Pavilion HPE h9-1100: Installation of the graphics card... Screen is not displayed. NEED SERIOUS HELP!

    Hi, so I recently got a new "XFX Radeon R9 285" graphic card PCI - E 3.0 and installed in my PC, I went to start it and the screen does not light. The PC boots, the fans run and everything just no display. It works with two other Radeon PCI-E graphics cards, but it does not start. 285 graphics card works in another computer, but will not work on this one. I tried to uninstall the old graphics card drivers and no luck.

    Motherboard: Gigabyte M3970AM-HP (Angelica)

    Model: 2AC8

    Supplier of chipset: AMD

    Chipset model: RD9x0

    CPU: AMD FX-8150

    PSU: 600w

    RAM: 10 GB

    ORIGINAL OF THE GRAPHICS CARD: RADEON HD 7600 SERIES

    OTHER MUCH OLDER BUT WORKS

    Thank you for the additional information.

    Since you had the card running in another computer, you must have connected the two power connectors 6 pins.

    If it were me, I would XFX Service contact customer (800-880-3225) to see what they have to say about your problem.  It may be a BIOS problem.  They need the specifications of your computer.

    Please click on the Thumbs up button '+' if I helped you and click on "Accept as Solution" If your problem is resolved.

  • How to move or resize the print dialogue box to fit my screen?

    At the moment the printing dialog box is located below the menu bar and extends below the screen.  I tried to go back or to resize it, but he didn't budge.  I don't see the buttons at the bottom.  I know that one is 'Cancel' and 'print' but there is a third - is - this "Save"?

    I use Windows 7 on a Toshiba laptop with Creative 6 screen resolution is 1280 x 720

    Any help would be appreciated

    OK, managed to delete the settings file.  However, the resizing problem continues.  I guess it must be my computer.  If it wasn't, this problem would have appeared before that.

    The taskbar to auto hide are my solution.

    Thanks for your help.

  • Adobe CS5 yet - should reduce the timeline image to fit screen

    Hi and thanks in advance for your help.

    I have 6 hours of talking heads at a conference not 1920x1080P.  As I make DVDs of video I find much of the image is 'cut' or outside the frame when played on a TV.  I play on a 65-inch DLP wide screen that is 'enhanced' 1080 p, 32 inch widescreen LCD that is not "upscaled" and a DVD player portable and all have the same effects.

    Each speaker is on a separate timeline.  I have change the timing of output to 90% of the height and 80% of the width to retain the greater part of the image (and their thin a little) when the DVD is played.  I have pre-made of timelimes to 720 x 480. MP4 files and import those into still make the DVD.

    If I do not reduce the percent image in the timeline, I get a fat looking for speaker with a lot of the image outside of the visible area.  Am I to compensate for something I'm doing wrong or is - this typical?  I understand the output for TV a visible 'safe' areas, but I thought which did apply to the new TV technology during DVD playback.

    I appreciate any help or comments, you can offer.

    Thank you

    Mel

    When you export mpeg dvd actually get you TWO files, a video and an audio

    You load both in still

  • Cropping of images to fit screen in video

    I do a video with images of hard drive using DVD Maker. I've finished adding photos, but they do not fill the screen. There are plenty of each side, which infringes on the show. Is there a way to resize to solve this problem?

    I do a video with images of hard drive using DVD Maker. I've finished adding photos, but they do not fill the screen. There are plenty of each side, which infringes on the show. Is there a way to resize to solve this problem?

    ===========================================
    Maybe the section "DVD Aspect Ratio" in the following article will help you.

    Windows 7 - change Windows DVD Maker DVD-Video settings
    http://Windows.Microsoft.com/en-us/Windows7/change-Windows-DVD-Maker-DVD-video-settings

  • Resize the slide background image in responsive project

    I test the functionality of master slide in a sensitive project and I was wondering if it is possible to resize a background image for the mobile view. For example, I have a background at 1024 x 768 pixel image that works very well for the office and view tablet but I'd love to be able to resize or be able to move into the mobile display to position it better. Is it possible in the master slide view or would it be better to just the image in the timeline panel on each slide?

    The included themes are sensitive, if you start from such a theme, you will have three views of breakpoint as for master slides. Is not what you want?

  • image width - Center and the culture of images to smaller screen sizes and keep the centered text?

    Hi people,

    I have an animation that I use as the header of my page.  It consists of a background image and some animated text blocks that are centered on the image.

    I would like to have the image extends to the entire width of the browser window, keep the image centered on the smaller screen size.  I also want to keep the blocks of text centered on the small screen so sizes.

    the question I have is that in smaller widths, the image 'glue' to the left of the browser window and not centered.  Finally, I would like to "reframe" the sides, but keep the image and the centered text.  comp stage has a min width to prevent him from becoming too small on smaller screens.

    Here is an example of what's going on.  I hope this helps.

    Screen Shot 2014-04-30 at 8.59.48 AM.png

    the dashboard computer is nested within a div - div, that he has the following properties.

    } .page-in-head-animation

    min-height: 400px;

    overflow: hidden;

    Width: 100%;

    text-align: center;

    }

    and the smaller screens, I have a media query

    @media only screen and (max-width: 768px) {}

    } .page-in-head-animation

    min-height: 300px;

    position: relative;

    }

    }

    so I want the computer on the edge to stop the downward revision when it comes to height of 300px and Center 'crop' from there.

    I have these settings on my stage.

    Screen Shot 2014-04-30 at 9.05.16 AM.png

    Please let me know if you have any ideas - I've been struggling with this for a while now!

    Thank you!

    You can not achieve what you're trying to animate. You will need to add CSS and script exernallly.

    Here is a link explaining how to Center a background image while the scaling.

    You have a div covering the lively scene.

    Value div, rather than having to animate background image.

    Make the transparent animated background

    Tutotrial: content http://www.minimit.com/articles/solutions-tutorials/fullscreen-backgrounds-with-centered-c

    Hope this helps

  • Force the Image to fill the screen when the user resizes the window

    I use flex and actionscript to create a site of photographer and I want the bottom to display an image that completely covers the bottom without distortion.  I tried just an image tag and characterized by the width and height to 100%, but the problem comes when the screen looks wider than the photo.  Thus, the height is reduced to 100% and the width is something less.  I would have rather it evolve according to what is most important, that is, if the window is too wide, the photo with a width of 100% on the scale and let the excess off the screen.  In this way, the photo is still cover the screen and there is no background color of distractrating showing.

    I was counting on the use of actionscript to indicate the width and height of the image so that I can compare it to the height and width of the window, but it seems that you can not get the dimensions of the photo.  I use application.width and application.height, but I need a way to compare it to the photo.  Also, is there an eventlistener that I should use to monitor when the user resizes the window or image resizing will be done automatically?

    Thanks for your comments,

    Tim

    The application container inherit "resize" event of UIComponent.

    Application.application.Width will give you the size of the application in the browser window.

    Thus,.

    function myResizer() {}

    img1. Width = Application.application.width;

    }

  • Screen display: in some way, I changed the size of everything on my screen using the F keys. How can I change this back?

    Somehow, I changed the size of everything on my screen using the F keys.  How can I change this back?

    Restore point:

    http://www.howtogeek.com/HOWTO/Windows-Vista/using-Windows-Vista-system-restore/

    Do Safe Mode system restore, if it is impossible to do in Normal Mode.

    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 the above does not fix it:

    Go to the Web site of the manufacturer of your laptop computer-graphics/computer card > drivers and downloads Section > key in your model number > look for the latest Vista drivers > download/install them.

    Then:

    http://Windows.Microsoft.com/en-AU/Windows-Vista/change-screen-resolution

    Change the screen resolution

    Screen resolution refers to the clarity of the text and images on your screen. At higher resolutions, items appear sharper. They appear also smaller, so more items adapted to the screen. At lower resolutions, fewer items adapted to the screen, but they are larger and easier to see. At very low resolutions, however, images may have serrated edges.

    See you soon.

    Mick Murphy - Microsoft partner

  • How to resize the desktop icons and fonts?

    I was working on my computer when I must have accidentally hit something and now everything is huge and I don't see even not all the icons on my desktop.  It's like I'm blind and everything is amplified. How can I change this back?

    Hello

    try a restore of the system before this happened

    http://www.windowsvistauserguide.com/system_restore.htm

    If necessary do in safe mode

    Windows Vista

    Using the F8 method:

    1. Restart your computer.
    2. When the computer starts, you will see your computer hardware are listed. When you see this information begins to tap theF8 key repeatedly until you are presented with theBoot Options Advanced Windows Vista.
    3. Select the Safe Mode option with the arrow keys.
    4. Then press enter on your keyboard to start mode without failure of Vista.
    5. To start Windows, you'll be a typical logon screen. Connect to your computer and Vista goes into safe mode.
    6. Do whatever tasks you need and when you are done, reboot to return to normal mode.

    try to get your site in manufacturere graphics or computer cards and find the driver download section

    Search your computer or graphics card model number based on what you have and download and install the latest graphics drivers for vista

    THEN try to make the screen of solution of problems

    http://Windows.Microsoft.com/en-us/Windows-Vista/change-screen-resolution

    Change the screen resolution

    Screen resolution refers to the clarity of the text and images on your screen. At higher resolutions, items appear sharper. They appear also smaller, so more items adapted to the screen. At lower resolutions, fewer items adapted to the screen, but they are larger and easier to see. At very low resolutions, however, images may have serrated edges.

    For example, 640 × 480 is a lower screen resolution, and 1600 × 1200 is higher. CRT monitors generally display a resolution of 800 × 600 or 1024 × 768. LCD monitors can better support the higher resolutions. If you can increase your screen resolution depends on the size and capability of your monitor and the type of video card you have.

    Text and images are sharper and smaller at high screen resolutions
    Text is larger and easier to read at low screen resolutions, but images are rasterized and number of items adapted to the screen
    1. Open display settings by clicking on the button start , by clicking on Control Panel, appearance and personalization, clickingPersonalization and then clicking display settings.

    2. Under resolution, move the slider to the desired resolution, then clickApply.

    Notes
    • When you change the screen resolution, it affects all users who log on the computer.

    • When you set your monitor to a screen resolution that it will not support, the screen will go black for a few seconds while the monitor returns to the original resolution

  • Portege M200: Need recovery due to the SD card CD

    Hello

    I have a M200, I got it again. However, I can't find my restore cd! Everything I need from the Image of SD card provided in this regard, is there anywhere I can get it?

    I have the XP Pro full windows cd, I work in an IT Department! But with the SD card image im lost!

    Any help would be great!

    Thanx

    Bob

    Hi Bob

    Original recovery media can be controlled by the Toshiba service partner authorized in your country. If you want to install your own OS you can find all the drivers, tools and utilities on Toshiba download page under http://eu.computers.toshiba-europe.com/cgi-bin/ToshibaCSG/download_drivers_bios.jsp

    Service partner you will find under http://www.csd.toshiba.com/cgi-bin/tais/su/su_gaspLocator.jsp?pf=true

  • Looking to update the graphics card in my Dell XPS 8900 EVGA GeForce GTX 960.

    I have a Dell XPS 8900 Special Edition that I bought a few months ago. I want to upgrade the OEM GeForce 745 of GTX that it came with an EVGA GTX 960.

    I have the Dell XPS 8900 (processor i7 - 6700 k), 32 GB of memory, 2 TB HDD + SSD of 32 GB m2, monitor cache Dell UP2516D and Windows 10 Pro. I'll add a second monitor Dell UP2516D soon and later add an SSD and move the OS and applications on.

    My needs are not at stake. I mainly business applications (MS-Office, including access and project), finance and investment, and a lot of photo and video editing.  Photo editing software uses the GPU if I update.

    EVGA has suggested either of the following, based on what would be good:

    http://www.EVGA.com/products/product.aspx?PN=04G-P4-1961-KR

    http://www.EVGA.com/products/product.aspx?PN=04G-P4-3963-KR

    These cards are almost identical except;

    #1 is long of 6.8 ", has 1 BIOS, 1 fan and use 128 watts for $160

    #2 is 10.1 "long, has 2 BIOS, 2 fans and consume 160 watts for $170

    I thought I would replace the graphics card myself, but once I opened the folder, I was wondering if the two cards will even fit.  I saw that other people have swapped their graphics card, so it must be possible.

    When I look in my case, the existing graphics card is a single location.  These two cards are double slot.  In addition, it seems that there are a few transistors just next to the existing card.  When you install a card double slot, the new map is just overlap the transistors under?

    Finally, in view of these two cards and the XPS 8900 case, is it possible to put the card in?  Is it worth the extra $ 10 earn an extra BIOS and fan, to the detriment of one more card of time and 12 watts?

    Any help or thoughts are greatly appreciated, thank you.

    Dual cards fit without any problem. Many have improved their 8900 XPS and 8700 with cards that need two slots of width.

    I prefer the models dual fan as they run cooler. They have a bigger heat sink and with relatively low heat from GTX 960, some are silent at idle because the fans do not work.

    For example, MSI GTX 970 son fan only above a certain temp that only happens every game. Maybe the EVGA card did the same thing. It is nice to have a quiet system at idle.

    Regarding the adjustment, the MSI GTX 970 games 4 G card Dimensions are (mm) 140 x 277 x 35. Length and height are tight but it fits without cutting.

    In addition, as noted speedstep you run SATA cables under the card. I replaced the SATA cables with longer cables, so they route toward the front of the box, then under the graphics card and upward.

    This thread has many cards different people have added. (the link is on page 26) and about the halfway point is my son with the MSI GTX 970 system, which (I think) is slightly larger that the EVGA 960 you listed.  It also shows the case mod to add a front fan.

    en.Community.Dell.com/.../19611037

  • Opacity of the place or slide show full-screen?

    I have a problem with a website full-screen and would like to know how to make one of the possible solutions:

    (1) is is possible to set the opacity on a slide show full-screen? That way the images are inserted in the background?

    (2) another option would be to be able to create a square full-screen on a layer above the slideshow full screen and set opacity on the square. Is it possible to define a place to be 100% full screen?

    Help, please

    Hello

    Here is the solution to your problems: -.

    (1) Yes, you can set the opacity of images on a screen full slideshow using the opacity option available in the control panel of Muse. Here's the screenshot:- http://prntscr.com/4nxxns

    (2) now if you want to control the way in which images are eliminated in your slide show and control that change in opacity and transition. You can do this by using slide show of 'Transition' and 'Speed of Transition' options. Define the Transition to the "bland" and control the speed of transition (change of opacity during the transition) according to your wish. Please refer to this screenshot:- http://prntscr.com/4nxy3p

    (3) No, you can create a square and place it above Fullscreen Slideshow and the control of its opacity using the opacity option. However now Muse does not offer this feature to create objects of full screen, what you do is use the 100% width option and which will cover the entire width if the browser. Please refer to this screenshot:- http://prntscr.com/4nxz58

    Also, I ask you to post you this feature request "objects full screen" on your part to ideas for features in Adobe Muse

    I hope this helps

    Kind regards

    Rohit Nair

Maybe you are looking for

  • try to import a picture to word

    try to import a picture to word and pictures does not open. When I updated the operating system, I noticed that not all my photos over the years have not saved in the photo icon. now when I insert new photos on the web, iphone Photos (under Media in

  • backup hd disappeared from the Office

    Today, I received a message that does not have my Time Machine backup.  While they inspected out, I find that my HD internal backup icon has disappeared from my office.  Yikes!  How find it & get it back?  I run first aid disk backup and the Info win

  • BT Stack selling or free license - but not for sale and not free

    Hi team Toshiba You did a good job over the years with the bluetooth stack. I think that your development team is the only professionally developed battery bluetooth for windows. It's happened that I bougt garage a SONY VGN-BX197XP laptop a few years

  • Remove (without the appellants) project dependency

    The Labview project is not allowing me to remove a dependency file (driver instruments) who has no callers, even if I have relinked all my files from project in the instr.lib folder. I have a dependency file something like "Agilent MXA series...". "l

  • How can I remove names from my list of contacts in Windows Live Mail?

    There are a lot of names in my contact list that I don't want... How can I remove them please?