Suggestions how to resize/compress images to be stored in a DB?

Hi,
Powerbuilder 11.5.1 application running on SQL Anywhere 11 DB
We are investigating possibilities to store images relating to rows in our table, we will probably do it as suggested, using Long Binary data type.
However, what would be really neat is if we had a way of resizing (cropping if needed) each image to a specific width / height in pixels, and also, just in case that these images were taken with a very large resolution, compress them down (photo quality not that important) to, say, 200kb-300kb at most. This would have to be done at the powerbuilder application level, when the user selects the image(s) to store.
Any ideas or guides on what is the best way to achieve this? There doesn't seem to be anything native in the libraries, does anyone know of any PB tools written that could accomplish this?
Cheers

Hi all,
some year ago  i published the following article on ISUG :
http://www.slideshare.net/marcocimaroli/image-magic-for-powerbuilder
I can share PB source files.
Thanks
Marco

Similar Messages

  • How to resize multiple images?

    I am newbie to RH and would like to know if there is a method /shortcut by which I can resize multiple images?
    Specifically to my project: I have close to 50 tables containing various images and their descriptions. When I insert these images into RH, the original image size is inserted and these images are of various sizes.
    I know how to resize multiple images in Word but not in RH and hence, reaching to higher powers
    I am using RH 9
    Appreciate all your help!

    Hi There, Well the best option is to resize each image individually but if you feel that you can select all images together and the  resize them all at once I am sure that you would like to give a read to this post from forums which talks about this job
    http://forums.adobe.com/thread/466933

  • How to resize display image item?

    How to resize an image in display image item not in column?
    I find a way to resize it in column which similar to this way
    decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null,
    '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius:
    4px;" '||
    'src="'||
    apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)||
    '" height="75" width="75" alt="Player Image" title="Player Image" />')
    detail_img
    but when I try to implement it to display image item which I returned the image from the column, I cant resize it this way, or may be I used wrong syntax, can you please help me finding way to resize it with steps?

    I guess it is because of some carriage returns in your dynamic img tag that is being generated may be not, so make sure there are no breaks half-way through he attributes of the img tag.
    decode(nvl(dbms_lob.getlength(PLAYER_PIC),0),0,null, '<img style="border: 4px solid #CCC; -moz-border-radius: 4px; -webkit-border-radius: 4px;" '|| 'src="'|| apex_util.get_blob_file_src('P5_PLAYER_PIC',ROWID)|| '" height="75" width="75" alt="Player Image" title="Player Image" />')  detail_imgand also inspect the element/img to see if the code is rendered correctly
    Thanks

  • Guys, i want to ask on how to resize the images into 1200 pixels wide?

    Guys, i want to ask on how to resize the images into 1200 pixels wide, how to do it? and what are the step by steps on doing that? thank you!!!

    See this link: http://forums.adobe.com/docs/DOC-3691

  • How to display an image, which is stored in a database?

    Hi All,
    I would like to display an image with Web Dynpro.
    I already know how to display an image which is stored in the path src/mimes/Components/...
    But does anybody knows, how to display an image which is stored in a database (e.g. MaxDB)as a datatype of binary?
    Thanks in advance!
    Regards,
    Silvia

    Hallo John,
    yes, you can use the Image UI element.
    Further you have to create a String for the URL. Implement like as follows:
    IWDCachedWebResource cachedResource = null;
    String imgUrl = null;
    WDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute(IPrivateXYView.IXYElement.PIC_DB);
    IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();
    binaryType.setMimeType(WDWebResourceType.JPG_IMAGE);//Example *.jpg
    WDWebResourceType type = binaryType.getMimeType();
    byte[] file = wdContext.currentXYElement().getPicDB();
    if (file != null)
    cachedResource = WDWebResource.getWebResource(file, type);
    try
    imgUrl = cachedResource.getURL();
    catch (WDURLException e)
    IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                        msgMgr.reportException(e.getLocalizedMessage(), true);
    I hope it will help you.
    Regards,
    Silvia

  • How to resize and image in iPhoto for a favicon on website

    I am trying to add "favicon" to my website and it says it says the image needs to be 16x16 or 32x32 and no larger than 100KB how do i resize the image i want to use to fir these guidlines?

    you go into iphoto then you click on the photo u want to re-size down the bottom there should be 4 icon there should be one saying edit click on that then up the top there are three icon click on the one that says quick fix the click on crop next to the word constrain there is a long bar click on that scroll down it will say custom click on that then put in the size you want the photo to be then u are good to go

  • How to resize GIF images

    Hi
    I used acme.jar to wirte gif images to a local disk . i worked fine , but iam facing problem in resizing these images , when i resize these images i get black background color in tat images .. can any body help me regarding this.....
    thumbImage = scaleToSize(imageWidth, imageHeight, thumbImage);
    Graphics2D graphics2D = thumbImage.createGraphics();
    graphics2D.setRenderingHint(RenderingHints.KEY_INTERPOLATION,
         RenderingHints.VALUE_INTERPOLATION_BILINEAR);
         graphics2D.drawImage(image,0,0,     thumbWidth,thumbHeight,null);
    out = new BufferedOutputStream(new FileOutputStream(newFilePath));
    GifEncoder gife = new GifEncoder(image,out);     
    gife.encode();
    this is my code .....

    Following is my code:
    public final String dealFile(ActionMapping mapping,ActionForm form,
                   HttpServletRequest request) throws FileNotFoundException, IOException{
              GroupForm gForm = (GroupForm) form;
              ActionMessages errors = new ActionMessages();
              // retrieve the file representation
              FormFile file = gForm.getPictFile();
              if (file == null) {
                   errors.add("FileNeeded", new ActionMessage("error.photo.filenull"));
                   saveErrors(request, errors);
                   return "failure";
              // has the maximum length been exceeded?
              Boolean maxLengthExceeded = (Boolean) request
                        .getAttribute(MultipartRequestHandler.ATTRIBUTE_MAX_LENGTH_EXCEEDED);
              if ((maxLengthExceeded != null) && (maxLengthExceeded.booleanValue())) {
                   errors.add("maxLengthExceeded", new ActionMessage(
                             "error.photo.length"));
                   saveErrors(request, errors);
                   return "failure";
              // retrieve the file name
              String fileName = file.getFileName();
              // judge file type
              String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
              if (!(fileType.equalsIgnoreCase("jpg")
                        || fileType.equalsIgnoreCase("jpeg")
                        || fileType.equalsIgnoreCase("gif") || fileType
                        .equalsIgnoreCase("png"))) {
                   errors.add("NotPict", new ActionMessage("error.photo.wrongformat"));
                   saveErrors(request, errors);
                   return "failure";
              Date date = new Date();
              Random r = new Random(date.getTime());
              // ������������
              String newFileName = request.getSession().getId() + r.nextInt(10000)
                        + "." + fileType;
              String filePath = null;
              String newFilePath = null;
              // the directory to upload to
              String uploadDir = servlet.getServletContext()
                        .getRealPath("/resources")
                        + "/groupphoto/" + DateUtil.asShortString(date)+"/";
              // prepare directory if not exists
              File dirPath = new File(uploadDir);
              if (!dirPath.exists()) {
                   dirPath.mkdirs();
              // retrieve the file data
              InputStream stream = file.getInputStream();
              // write the file to the file specified
              OutputStream bos = new FileOutputStream(uploadDir + newFileName);
              int bytesRead = 0;
              byte[] buffer = new byte[8192];
              while ((bytesRead = stream.read(buffer, 0, 8192)) != -1) {
                   bos.write(buffer, 0, bytesRead);
              bos.close();
              buffer = null;
              filePath = dirPath.getAbsolutePath() + Constants.FILE_SEP
                        + newFileName;
              File _file = new File(uploadDir + newFileName);
              Image src = ImageIO.read(_file); // ����Image����
              int width = src.getWidth(null); // ����������
              int height = src.getHeight(null);// ����������
              // convert the picture to picture within 100x100 and save to a file with
              // prefix
              // 100x100_ for later listing purpose.
              newFilePath = dirPath.getAbsolutePath() +Constants.FILE_SEP
                        + "100x100_" + newFileName;
              int newWidth = 0;
              int newHeight = 0;
              int bigger = width <= height ? height : width;
              if (bigger > 100) {
                   if (width >= height) {
                        newWidth = 100;
                        newHeight = height * 100 / width;
                   } else {
                        newHeight = 100;
                        newWidth = width * 100 / height;
                   ImageUtil.convert(filePath, newFilePath, newWidth, newHeight);
              // close the stream
              stream.close();
              _file = null;
              src = null;
              dirPath = null;
              String url = request.getContextPath() + "/resources" + "/groupphoto/"
              + DateUtil.asShortString(date)+"/"+ "100x100_" + newFileName;
              return url;          
         }

  • How to resize photoshop image without changing canvas size?

    When i had the older versions of photoshop i would change the image size and it would enlarge on my canvas for me to rearrange. Lately i realized on CC when i increase image size so does my canvas size. Is there anyway to prevent my canvas size from increasing too?

    I am having what appears to be this same issue.    I am using PS CC.  
    hello @ c.pfaffenbichler
    I resized my image in image> image size.  
    Details:
    I am not a ps expert but woefully self taught.  However through much trial and error I have in my experience over the years, achieved some comfortability with the image size dialog box as well as the canvas size dialog box.  SOME comfortability lol.  That is, I feel that I understand what is going on most of the time and when flummoxed have studied adobe literature or read hundreds of posts here and elsewhere to gain additional knowledge which many times resolves the issue.  I like digging and finding the answers.
    In this case, my digging is done dug a giant hole and I am exhausted and found nuthin'.
    I feel like I am going nutso.
    In my mind,
    1.  There is the image I am working on
    2.  There is the canvas the image is sitting on
    My expectation and previous experience is that I can change the Image size by going to Image > image size and this change does not affect the canvas size.
    My expectation and previous experience is that I can go to Image >canvas size and change the canvas size and this does not affect the image size.
    I could also use the Transform to resize the image which also, would not in my expectation, change the canvas size.
    In the beginning of my workflow on this particular collage I did not have this issue,  so that leads me to believe I did or am doing something to cause this rather than it being some kind of bug.    But what do I know.
    I thank you in advance for your assistance.

  • How to resize large images without losing quality

    Hello I have an image that I am trying to use as an email. Right now it is 2108 pixels. And for an email it should be 600 px. I created this image in illustrator as vectors and type.
    Whenever I go into image size and i change it to be 600 pixels it gets extremely blurry. I have also tried converting this to a smart object... doesnt work. How do I resize my large image to be smaller without losing quality???

    here is an example sceenshot of the opening dialog (.ai opened directly in Photoshop)
    your illustrator vector should be rastered sharp at 100% actual Pixels in Photoshop
    that is where you want to evaluate sharpness in Photoshop...
    then File> Save for Web & Devices (and drag that saved file icon into an open web browser)
    still no joy, embed your saved image here using the forum's camera icon...

  • How to -not- compress images on import?

    Hi all,
    Sorry if this has come up a gazillion times before, but I cannot seem to figure it out.
    I want to create a simple PDF containing some images and two videos for laptop/beamer presentation.
    Whatever setup I do with the Distiller presets regarding importing images, Acrobat always compresses the imported images, leaving them less than crisp.
    I just want them (JPG's) imported and shown -as is-.
    Is this impossible in Acrobat, or am I missing a very obvious setting somewhere deep in the Distiller options?
    Cheers for any replies,
    rob

    Sorry if I didn't make myself clear(er).
    If I create a PDF with Acrobat, it will -always- compress the images.
    After reading up on the manual, it seemed the Distiller settings are responsible on how Acrobat  behaves with importing images.
    I created profiles with Distiller to not compress anything, and choose that as printersetting for a new PDF.
    It still compresses my images, it's annoying!!!!
    My workaround for now is to create a OO Impress Presentation, export that to a PDF, open that PDF in Acrobat, add my videos (as Impress can't) and save that to a new PDF. This works as I want it to work (no compression on my images).
    I hope this helps explaining it a bit more, and thanks for any insights.
    rob

  • How to resize an image without squashing it?

    I am trying to add image to mug template ,so when I resize it get squashed how I resolve this
    thanks

    Hold the shift key down while resizing, and check that the percentages are the same in the top bar. (The numbers on the far right in these screen shots)
    It doesn't matter what the numbers are, as long as they match each other.
    WRONG:
    CORRECT:

  • Anyone how to resize an image using imagereader and imagereadparam?

    I want to use imagereaderparam to process the image.
    MY code is as follow:
    ImageReader reader = _editor.getImageReader();
         try
         if (reader != null)
                   int w = reader.getWidth(0);
                   int h = reader.getHeight(0);
                   ImageReadParam param = reader.getDefaultReadParam();
                   //param.setDestination(reader.read(0));
                   Dimension d = new Dimension(my_width, my_height);
                   param.setSourceRenderSize(d);
                   BufferedImage bi = reader.read(0, param);
         } catch (Exception e)
              e.printStackTrace();
    This code just not work , and get an exception
    java.lang.UnsupportedOperationException: Can't set source render size!
    anyone know how to do that ?
    coz i dont want to use getScaledImage...

    Hi,
    Are you just trying to produce a BufferedImage at a smaller size? May I ask why you don't want to use getScaledInstance? I agree with you not to use it. It is slow. Just wondering what your reasons are. If all you need is to take one image and make it a different size, try this:
    BufferedImage src = ...
    int scale = 0.5f;
    int w = (int)(src.getWidth(null) * scale);
    int h = (int)(src.getHeight(null) * scale);
    // could use TYPE_INT_RGB if there's no alpha in your image
    BufferedImage dest = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
    Graphics g = dest.getGraphics();
    g.drawImage(src, 0, 0, w, h, null);
    d.dispose();How does that work for you? It should be pretty quick.
    Shannon Hickey (Swing Team)

  • How to resize multiple images if large enough?

    Hello there!
    I asked a question in this thread: http://forums.adobe.com/message/5424733#5424733, and was redirected here.
    My problem is that i need a way to resize a bunch of images in two different sizes.
    One of the sizes is 1500px wide and that is no problem, since all of the images is wider then that.
    The other size is 4000px wide, but not all of the images is that wide.
    Therefore I only need to resize the ones that is more than 4000px wide, but i can't seem to dot that.
    Does anybody know a script that I could use or have another solution to my problem?
    I'm running Design Premium 5.5
    Kind regards,
    Tommy Frost

    Thank you for your answer.
    I figured it out, or rather, JJMack figured it out for me: http://forums.adobe.com/message/5424733#5424733
    But thanks anyway

  • How to resize a image? Please come in

    I want to load a picture from E:\abc.jpg, then resize,and save to disk E:\xyz.jpg.
    Who can give me a demo?
    Thanks a lot.

    If you want to do it locally (not on a webserver) try the following. I got it while trying to find a way to create thumbnails online.
    Download the class from java.sun.com/products/jimi
    Keep the class files in your classpath of current directory.
    import java.awt.Image;
    import com.sun.jimi.core.Jimi;
    import com.sun.jimi.core.JimiUtils;
    class Thumbnail {
    public static void main(String[] args) {
    try{
              Image outImage = JimiUtils.getThumbnail(args[0],Integer.parseInt(args[2]),Integer.parseInt(args[2]),Jimi.IN_MEMORY);
    Jimi.putImage(outImage, args[1]);
    System.exit(0);
    catch(Exception e){
                   System.out.println(e);
    You must call this with 3 params.
    java Thumbnail <inputfile> <outputfile> <required size of the new image>
    I hope this will help.
    - Dantus

  • How to resize original image that received from server

    Hi Helper's,
    I'm getting error on time of resizing image such as "Error #2030: End of file was encountered". I want to resize as per specified size. Code is written in Flash builder 4.5. Please find my code below and help me to correct.
    <?xml version="1.0" encoding="utf-8"?>
    <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
                   xmlns:s="library://ns.adobe.com/flex/spark"
                   xmlns:mx="library://ns.adobe.com/flex/mx" minWidth="955" minHeight="600"
                   initialize="initNew()" xmlns:local="*">
        <fx:Declarations>
            <!-- Place non-visual elements (e.g., services, value objects) here -->
        </fx:Declarations>
        <fx:Script>
            <![CDATA[
                import mx.controls.Alert;
                import mx.graphics.codec.JPEGEncoder;
                private const image_path:String = "sample.jpeg";
                private var loader:Loader;
                private var request:URLRequest; 
                private var loadBD:BitmapData;
                private var cropBD:BitmapData; 
                private var squareW: int = 75;
                private var squareH: int = 100;
                private function initNew():void
                    loader=new Loader();
                    request=new URLRequest(image_path);
                    loader.contentLoaderInfo.addEventListener(
                        Event.COMPLETE,onComplete);
                    loader.load(request);
                private function onComplete(event:Event):void {
                    try
                        loadBD = Bitmap(event.currentTarget.content).bitmapData;
                        var bitmapData:BitmapData = new BitmapData(squareW, squareH, true, 0);
                        bitmapData.draw(loadBD);
    //Getting error in this line
                        var ba:ByteArray = (new JPEGEncoder()).encodeByteArray(bitmapData.getPixels(new Rectangle(0, 0, squareH, squareH)), squareH, squareH, true);
                        ba.position = 0;
                        imgResized.source = ba;
                    catch(e:Error)
                        Alert.show(e.message);
            ]]>
        </fx:Script>
        <s:BorderContainer id="bcImage" width="75" height="100" maxWidth="59" borderWeight="1" borderColor="red">
            <s:Image id="imgResized" width="100%" height="100%"/>
        </s:BorderContainer>
    </s:Application>
    If anyone faced similar kind of problem?

    drkstr_1 wrote:
    Is there a specific reason why using a BitmapImage would not work for your use case? If you are worried about the overhead, I would take a look at the source and copy out the bits you need. One thing I noticed after looking at the source is that they do not use any kind of encoder to perform that functionality. Is there a specific reason you need this?
    Thanks for your reply and happy to see you.
    No reason, I got above code When I google it and changed accordinaly to meet req. My requirement is, server will be giving 400*350 (Byte array) size image. That one what to resize into 75*100 and apply it to image component. I'm fine with any approarch, however if the image size is less than 75*100, then should not stretch the image. I have tried with fillMode (BitmapFillMode.CLIP), scaleMode(BitmapScaleMode.LETTERBOX). Please update your concern on same.
    Note: Plz ignore this maxWidth="59" property in BorderContainer property.

Maybe you are looking for

  • Convert binary to base64

    I've a special problem. I've a BSP for uploading files from Windows XP-Clients. The file should be transferred to a .NET web service where the file is written to disc (1:1, means the binary is written like it is to disc). The transfer from the file t

  • My iPad 2 home button stopped working fluently for like 5 mins

    should I be worried ? It's working now and It just happened this first time is it a sign?

  • Redhat linux 6 VM - stop and  restart

    Hi, I've installed new HVM - Redhat Linux 6, standard installation. I have the problem with stop and restart initiated from the OVM console. Job is running, but the OS inside VM doesn't start the shutdown process. For example another VM running Oracl

  • Customizing Code Templates for the Code Editor

    Our customer wants to have a standerd code edit environment for developers using Jdveloper. Therefore, there is a need to customize the Code Template for the Code Editor. The question is once after it is customized, whether it is possible to export t

  • Converting to MP3 or WAV - keep getting msg - protected files cant convert-

    When I right click and select convert to MP3 or WAV I keep getting the message the fle is proctected and cant be converted to other formats such as MP3 or WAV ....IS there a way around this or do I need to burn a cd and then rip it ? If I do this the