Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development

Reply
Developer
Posts: 692
Registered: ‎08-09-2010
My Device: Not Specified

How to resize image of selected from picker?

Hello,

 

   May i know how to resize image which i selected from picker??

 

   Right now image height and width are very high,So now i resize image into 800x600.So may i know how to do ??

Developer
Posts: 16,992
Registered: ‎07-29-2008
My Device: Z10 LE, Z30, Passport
My Carrier: O2 Germany

Re: How to resize image of selected from picker?

using the search function should help to resolve questions like that.
i have used it for you:
http://supportforums.blackberry.com/t5/Native-Development/ImageView-cascades-noob-question/m-p/17048...
----------------------------------------------------------
feel free to press the like button on the right side to thank the user that helped you.
please mark posts as solved if you found a solution.
@SimonHain on twitter
Developer
Posts: 54
Registered: ‎05-14-2013
My Device: LE Z10
My Carrier: Ben(T-Mobile network)

Re: How to resize image of selected from picker?

You can use the QT's QImage in C++ to resize and save a new file, for example

 

QImage originalImage(originalFilePath);
QImage smallerImage = originalImage.scaledToHeight(384,Qt::FastTransformation);
QFile outFile(newFilePath);
outFile.open(QIODevice::WriteOnly);
smallerImage.save(&outFile, "JPEG");

 This defines a QImage on the original file path location, next it defines a new QImage, which is a height scalled version of the original image. Then it creates a new file at the new filepath location, opens it and writes it to that location.

 

Also take a look here:
https://qt-project.org/doc/qt-4.8/qimage.html

Don't forget to mark as solved and like my post if it helped out!
Developer
Posts: 1,163
Registered: ‎03-20-2013
My Device: Red LE Developer Z10
My Carrier: Fido

Re: How to resize image of selected from picker?

No need to save the resized image to a file before using it, you can load it directly into a Cascades Image, although it is a little tricky. For some reason the BlackBerry 10 design team elected to give us an image control that basically does nothing really useful, whereas the Qt QImage control allows all kinds of image manipulation. The soon-to-be-released next version of my multiFEED app converts images from web pages into small thumbnails for display in a ListView.

 

The trick is to load the picked image into a QImage and keep it there until just before it is displayed. That way you can manipulate it as much as you like before converting it to a Cascades Image. Unfortunately it is not possible to go the other way, from Cascades Image to QImage, since the image data is not exposed by a Cascades Image once it has been loaded.

 

To convert a QImage to Image copy the QImage pixel data into a Cascades ImageData, then load that into the Cascades Image. Details are here.


ETitus wrote:

You can use the QT's QImage in C++ to resize and save a new file, for example

 

QImage originalImage(originalFilePath);
QImage smallerImage = originalImage.scaledToHeight(384,Qt::FastTransformation);
QFile outFile(newFilePath);
outFile.open(QIODevice::WriteOnly);
smallerImage.save(&outFile, "JPEG");

 This defines a QImage on the original file path location, next it defines a new QImage, which is a height scalled version of the original image. Then it creates a new file at the new filepath location, opens it and writes it to that location.

 

Also take a look here:
https://qt-project.org/doc/qt-4.8/qimage.html






Developer of Built for BlackBerry certified multiFEED RSS/Atom feed reader and aggregator.  multiFEED Icon

Play nice: Clicking Like Button on posts that helped you not only encourages others to continue sharing their experience, but also improves your own rating on this board. Also, don't forget to accept a post if it solves your problem or answers your question.
Highlighted
New Developer
Posts: 7
Registered: ‎02-17-2013
My Device: none
My Carrier: HTC

Re: How to resize image of selected from picker?

Ask one simple question. How can I resize and process source image to a larger width & height, without changing its original resolution(I mainly refer to those raster image formats, like gif)

New Contributor
Posts: 6
Registered: ‎06-13-2013
My Device: fdsfd
My Carrier: blackberry

Re: How to resize image of selected from picker?

[ Edited ]

caryshiller wrote:

Ask one simple question. How can I resize and process image to a larger width & height, without changing its original resolution(I mainly refer to those raster image formats, like gif)


hello, caryshiller, what you are talking about is about an image processor program will help you