Change Bitmap height width

How can I change the width of the bitmap n height.

How do I get the byte array... I did some research already here but did not get the right answer. all change in size of the images by images to server huy how to change ican. in the local area.

Thank you

Zahid

I'm not sure if I understand the question. But you try to resize a file that is located on the spot? Add it to your project.

This is a snippet of code Bika wrote:

Functions 1 and 2 are for resizing a bitmap, function 3 is to resize an encoded image.

public static Bitmap resizeBitmap(Bitmap image, int width, int height)
    {
        int imageWidth = image.getWidth();
        int imageHeight = image.getHeight();

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

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

        // Call to our function and obtain rgb2
        int rgb2[] = rescaleArray(rgb, imageWidth, imageHeight, 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;
    }  

    public static EncodedImage ScaleImageToSize(EncodedImage image, int targetWidth, int targetHeight)
    {
        if (targetWidth > 0 && targetHeight > 0)
        {
            int imageWidth = image.getWidth();
            int imageHeight = image.getHeight();
            /*
            float scaleX = ((float) imageWidth / (float) targetWidth) * 10000;
            float scaleY = ((float) imageHeight / (float) targetHeight) * 10000;*/

            int numerator = Fixed32.toFP(imageWidth);
            int denominator = Fixed32.toFP(targetWidth);
            int fixedX = Fixed32.div(numerator, denominator);

            numerator = Fixed32.toFP(imageHeight);
            denominator = Fixed32.toFP(targetHeight);
            int fixedY = Fixed32.div(numerator, denominator);

            //int fixedX = Fixed32.tenThouToFP( (int) scaleX);
            //int fixedY = Fixed32.tenThouToFP( (int) scaleY);
            EncodedImage retImage = image.scaleImage32(fixedX,fixedY);
            return retImage;

        }     

        return image;
    }

Tags: BlackBerry Developers

Similar Questions

  • How can I change just the width or the height of a brush in CS4

    I have a brush that is square.  Is it possible to change just the width or just the height and if so, how?

    Press F5 on your keyboard and in the Panel of brush that appears, drag with the mouse on the word 'Roundness' or drag the high point or at the bottom of the circle representing the roundness of brush. Alternatively, the percentage of roundness it.

  • Change the height and width of the video image...

    In Adobe Premiere Pro CS 5, I can't produce a video larger than the width of the frame (of output): 720 and frame height: 480. The video is recorded in full HD 1920 x 1080 p, but after editing and adding effects in first Pro CS5, changes in video for only 720 x 480.

    (1) where the settings in Premiere Pro are modified to produce a video size of the width of the frame: 1280 and frame height: width 720 frame or even: 1920 height: 1080?

    (2) is it possible to produce 1920 x 1080 or 720 x 480 max video?

    Your time is appreciated.

    File > new > sequence, then:

    1. Choose a preset that matches or is less similar to your videos, or,
    2. Click the general tab, change the editing for "Desktop" Mode and set the parameters as you need for your videos

    Otherwise, drag a film clip to the button new item at the bottom of the project Panel (it looks like the dog-swamp of paper sheet) and created a sequence corresponding to your images.

  • create VerticalFieldManager with specific height/width

    I wonder how I can create a vertical box with a specific width Manager. I labelfields containing text that changes the length of the field and so changes the width of the vertical area Manager (I have 2 side by side). I wish to have fields to stay in the same place regardless of the length of the text (I'll put the field large enough to accommodate the maximum length). So, how can I do this? I think this means the following code, but if anyone can help with the details I would be grateful, thank you!

     protected void layout(int width, int height)
        {
            width = this.width;
            height = this.height;
            super.layout(width, height);
            super.setExtent(width, height);
        }
    

    I'll give you a quick answer here.  I'm not the right person to do it, but I suspect that you won't see most of the people better than me until tomorrow.

    I highly recommend to check this article:

    http://supportforums.BlackBerry.com/T5/Java-development/create-a-custom-layout-manager-for-a-screen/...

    But looking at your current code, I might be able to explain a few things that will help you.

    Each manager is says how it can be by the sublayout call framework, with the maximum width and height that the Manager can use.  Each Manager works how big it must be iteratively in all areas, there and asking them what size they want to be.  It does this by calling the method of positioning of the field, and he passes two values, width remaining, and the height that remains.

    A VerticalFieldManager will tell all its areas they have the entire available width, and the height of the rest, this height will be some height the value for money was given, less all the fields above already asked.  Back of page layout, optimization of resources will be ask the field how much height is really needed and subtract that before calling the layout on the next field.

    In any case, I hope that is clear from this that if you override sublayout in a VerticalFieldManager, as follows, and then she will layout all its fields with a maximum width of 1/2 the display.

    protected void sublayout (int width, int height) {}

    Super.sublayout (Display.getWidth () / 2, height);

    }

    If you do this, you don't need to touch the field positioning method at all.

    I hope this helps.

  • getPreferredHeight does not change the height of a LabelField.

    Hello

    I add LabelFields at a screen. I replaced getPreferredWidth and the LabelField getPreferredHeight. GetPreferredHeight however does not change the height of LabelField.

    getPreferredWidth seems to work very well.

    I do not use the default vertical Manager that comes with the screen.

    Ideas/pointers in troubleshooting this would be greatly appreciated.

    -MO.

    Hello

    to change dimensions on a field, you must override the method of layout.

    protected final void layout(final int width, final int height) {
        int yourHeight = super.getFont() * 2;
        super.setExtent(width, yourHeight);
    }
    

    If you want the label is centered vertically, you must override the paint method.

  • I can not change the height of a track?

    I'm changing the height of a track, but whenever I try I change the height of all.  In Garageband 10.1.0.  I've looked everywhere but I can't find answers.  Help, please!

    Is which way? An ordinary audio track?

    • You can either add an AuPitch filter to the track - add a plug-in in smart controls.
    • Or select all regions and transpose the regions in the track editor.

  • How to change the line width of underline and color (on my MacBook or iPad)

    When you use my MacBook or iPad, how can I change the line width and color when you use the underline tool or the pencil tool?

    Hi Backpacker48,

    .. using the underline tool or the pencil tool

    I'm fairly certain that you may have about the comment tools.

    To highlight the tool, there is no option to change the line width (thickness).  But you can change the color and opacity.  In addition, you can change the style in the desktop application.

    For the Pencil tools or drawing freehand, you pouvez change the width of the line (thickness) in addition to the color and opacity.

    The key here is to change the properties of an existing comment, once it is added to a page.

    Acrobat Reader DC (desktop application) on your MacBook

    1. Right click on the brand of underscore or existing pencil.
    2. Select properties from the context menu.
    3. Select appearance (if not already displayed).
    4. Specify the value of a property (color, opacity, Style or thickness).

    Acrobat Reader for iOS (mobile application) on your iPad

    1. Tap the existing underlining or drawing freehand.
    2. Select a property (color, opacity, thickness) in the menu that appears.
    3. Specify the value of the property.

    Once you change a property (for example, thickness, color, opacity), the mobile app will remember the new value of type specific comment for next time.

    Please let us know if you have any additional questions.

  • You can timestretch without changing the height in first?

    You can timestretch without changing the height in first?

    anyone?

    You can change the speed/duration without changing the pitch by ticking the 'Preserve Audio Pitch' to clip speed / duration dialog.

    If you use time-remapping (which is a fixed effect), it is n/a, because the time remapping effect only affects the video track.

    Adobe Premiere Pro - maintenance Audio Pitch (VOXLAB tutorial) - YouTube

  • How to change the height of the highest point

    I'm highlighting the text in a document that I converted from a web page using the converter in Acrobat. The highlighted height is about 2 lines of text at the top, while I highlight a line it also half of the above line and half of the line beneath the line that I am highlighting. This makes it very inaccurate light. It's like highlighting with a very broad, dull highlighter. This happens usually when I highlight the documents, but that happens on this particular document. I can't find any way to change the height of the highlighter. I use Acrobat Professional X 10.1.13 version.

    Here is an example:

    highlighting example.jpg

    Thanks for a fix.

    The highlighter uses the underlying 'box' that defines each word. You will see that it is even when you select with the mouse.

    This could be the result of an imperfect OCR process, or a bad PDF engine used to create the file. Basically it is not that you can do about it.

  • Is this possible in items 11 - question of height/width of film

    to export a movie on your computer (for later use in a Web page) according to your own definitions of size?

    For example, I have a Web page that expects a movie with the following: width = 275 pixels of height = 240 pixels. It is important that I keep these measures if the layout of the page deforms and inapplicable because there is an effect of 'hit '.

    Therefore, I need to define the size of the film under items (unless there is another way).

    At the moment, if I right click on the movie in Windows 7 (in other words, the film I exported 11 elements), and then select Properties, I can only see the file size in KB, MB, or whatever and not actual dimensions height/width.

    Thank you.

    Steve

    Steve

    Thank you.

    Feel free to ask questions that evolve from your new exploration and experimenation with the suggested workflow.

    RTA

  • Change the height on Carousel causes jump

    I have a carousel on this page: https://neighbourgood.co.UK/ and because the text changes the height of the item changes causing the page jump.

    Can someone suggest an easy solution?

    Thank you

    Martin

    PS: I should have said, the biggest problem is on a smartphone.

    A simple solution is to set a fixed height to the container of the carousel:

    Line 781 of bootstrap.min.css? ver = 2.0.3

    . Carousel {position: relative; margin-bottom: 20px; line-height: 1;} { height: 250px;}

    This way the div after the div .carousel governs the height 250px for Carousel, which will start to 251st pixel (relatively) on screen.

    The green zone with legend will expand and contract depending on the amount of text it holds. However, 'jump' stops.

    -ST

  • Find the height/width of the Flash Builder project

    Hey,.

    How do you find the height/width of the project as an integer to use in the code. I found stage.stageWidth but who does not display anything when I try and use it

    Thank you

    Chris

    > I am doing in a project mobile btw, if that makes a difference

    He would try flash.system.Capabilities.screenResolutionX

  • Box height/width

    Is it possible to turn off the little gray box with the height/width, which is displayed when you try to adjust the size of something?  Many times, he ends up covering something that I need to see the adjustments.  It really starts to annoy me.  So, if anyone knows how to disable this feature, I would be very grateful!

    Preferences > Interface... and uncheck "Show transformation values" in the cursor Options.

  • Change the height of a multiselectlist

    Hello experts!

    I created a page with a whole lot of items/Articles (ca. 40). On this page, the user can set several selectioncriterias which
    are the basis for other pages.
    Among these items, I also have Multiselectlists that can hold up to 60 and mor entered.
    For reasons of ease of use, I want to achieve the following objectives:

    Initially, the height of the MultiSelectList is 1 line. I would like to have a little button next to the multiSelectlist, which
    change the height of a certain height (i.e. 10 lines), so that I can discover more than one line and make my selection
    easier. When I press the button again, the height must go back to 1 line.

    Is there a way to do this? I was thinking some Javascripts, but could not do any solution.

    I appreciate your support and feedback.

    Best regards.

    KMC

    Hello

    Have your call touches something like:

    <script type="text/javascript">
    function changeSize()
    {
      var sl = document.getElementById("XX");
      sl.size = sl.size == 1 ? 10 : 1;
    }
    </script>
    

    Change "XX" in the name of the item to your selection list.

    Andy

  • How to change the height in table of the field of Bitmaps

    Dear developers BB,

    I work with a table of the field (3 x 3) whose I am filled with bitmap images.

    I loaded all 9 images successfully, but I don't know how to resize the height of the lines if the pictures would be good.

    Any help would be greatly appreciated.

    Code snippet:

    In the main routine:

    Field [] [] tableContent = new field [3] [3];

    tableContent [0] [0] = new BitmapField (TopLeft);

    ...

    tableContent [2] [2] = new BitmapField (BotRight);

    int [] width = {40, 40, 40};

    paddings of int [] = {20,20,20};

    Screen.Add (new TableListField (tableContent, widths, paddings));

    pushScreen (screen);

    outside the main routine...

    private final static Bitmap TopLeft = Bitmap.getBitmapResource ("topleft.jpg");

    ...

    private final static Bitmap BotRight = Bitmap.getBitmapResource ("botright.jpg");

    class TableListField extends ListField

    public TableListField ([] [], int [] columnWidths field content,
    int [] horizontalPaddings)
    {
    numRows = contents.length int;

    Create a line for each line.
    _rows = new TableRowManager [numRows];
    for (int curRow = 0;  curRow< numrows; ="" currow++)="">
    _rows [curRow] = new TableRowManager (happy [curRow]);
    }

    _columnWidths = columnWidths;
    _horizontalPaddings = horizontalPaddings;
    setSize (numRows);
    setCallback (RENDERER);
    }

    I imagine that your RENDERING engine takes three images for each line and displays those all the row using a drawBitmap (...) for each?

    In any case, the height of the row in the ListField is controlled by the ListField.setRowHeight () method.  You probably want to replace this:

    Screen.Add (new TableListField (tableContent, widths, paddings));

    with

    TabList TableListField = new TableListField (tableContent, widths, paddings);

    tabList.setRowHeight (TopLeft.getHeight () + 1);

    Screen.Add (tabList);

    I hope this helps.

Maybe you are looking for

  • I use the option on the Web page to open something and end up with empty new tab.

    I'm on a web page and there is an option to open or scan another page available. I press the button or the highlighted option. It shows me so it transfers data and transferred me to a new tab, but when he made the new page has nothing about it. There

  • ASIX MCS 7832 pilot to 200 for USB 2.0 to Ethernet?

    Digitus made a USB to Ethernet Dongle (DN-10050) using the 6 MCS 7832 chip. This dongle would be directly usable in 200? This is true, the driver 6 MCS 7832 must be pre-installed by Toshiba or be already present in ICS. If not, is there another drive

  • my phone is not supported sim.phone is i44s and serial number is C8 * T9Y

    my phone is not supported sim.phone is i44s and serial number is C8 * T9Y < personal information under the direction of the host >

  • Siri Option not available

    Just bought an iPad running IOS 9.2.1 3. In the General settings, I see no Option Siri nor I see the Option dictated in the keyboard settings. Restrictions is set to Off. I don't know this model iPad (MD-368C/A) IS compatible with Siri. Should Siri b

  • Bluetooth HP Pavilion 15 p000su problem

    Hello. After that Paul_Tikkanen helped me on my WIFI I thought that my HP Pavilion 15 p000su-J2T31EA (OS: Windows 8.1) has no more problems, but there are still some problems. It seems that the bluetooth found no devices or be found by other bluetoot