Reduce image size

Hello,
I have a question about reducing the size of an image.
What i want is to load an image.. resize it and then save it
into a blob(sqlite air db)
In php you say imagecopyresampled and you can save a smaller
image.
How to do this in flex?
What i have is an function witch resizes the given image, but
i doubt the image is really reduced in size..(from 900 to 100k)
code:
package
import flash.display.Bitmap;
public class imageresize extends Bitmap
//globals
private var bmp:Bitmap;
private var true_width:Number;
private var true_height:Number;
private var maxx:Number;
private var maxy:Number;
private var resize:Boolean;
public function
resizeImage(b:Bitmap,h:Number,w:Number):Bitmap
this.bmp=b;
this.maxx=w;
this.maxy=h;
this.true_width = bmp.width;
this.true_height = bmp.height;
//this.true_width2 = imagesx($image);
//this.true_height2 = imagesy($image);
this.resize=false;
if (true_width>maxx) resize=true;
if (true_height>maxy) resize=true;
if (resize==true)
var width:Number=maxx;
var height:Number = (width / true_width) * true_height;
true_width=width;
true_height=height;
if (true_height>maxy)
height=maxy;
width = (height/true_height)*true_width;
else
width=true_width;
height=true_height;
else
width=true_width;
height=true_height;
width=Math.ceil(width);
height=Math.ceil(height);
// this is used extra in php to get a smaller image
//$dest_img = imagecreatetruecolor($width, $height);
//imagecopyresampled(
// $dest_img, $image,
// 0, 0, 0, 0,
// $width, $height, $true_width2, $true_height2); // resize
the image
//return $dest_img;
bmp.height=height;
bmp.width=width;
return bmp;
please some help here,sorry for the way i put the code here..
i couldn't find the attach code button..
or did i have to use [attach code]? maybe handy to change the
string attach code into a link..
Greets, jacob

perhaps another nice thing is to encode it to base64 so it
can be saved into the sqlite database.
I found my one solution by encoding it to a base64 string and
store it into the db.
Here a link to the topic with the solution.
link
to the topic with my solution
Greets, jacob

Similar Messages

  • Reduce image size and print it out?

    I scanned an image (coloring on a postcard). This size is too big to fit into a 'album' picture in MS Picture It! All I want to do is REDUCE the image and save it so that it will fit into the computer photo album I'm creating.
    I've tried Image/Resize/Image Size and changed the sizing, but it still comes out the exact same size as the original. What am I doing wrong?

    > I want to REDUCE the image, not enlarge it.
    I understood that - what makes you think I didn't?
    > It's 948x645 pixels. I just want the image about an inch (respectively) smaller
    You can't think in terms of inches for screen images. You have to work in pixels and the actual size will depend upon the screen resolution on the machine being used to view the image.
    I'd reduce the pixel size by about 80 to get the effect that you want. Use Image/Resize/Image Size and make sure that you have "Resample" checked.

  • How to reduce image size on photoshop without losing quality

    i have a logo that needs to be shrunk. but as soon as i shrink it the image looks pixelated. if i leave it as-is, the website says the size is too big. please advise.
    Dale Mundi

    When you reduce its size, you are removing pixels which is one of the reasons it can look pixelated. You could add a slight blur, but that may make it look worse.

  • How to reduce image size on account of disk space shortage?

    I import images from my camera to iPhoto on my MacBook. I want to reduce their size on import because hard disk space on MacBook is limited.
    Is there any smart way how to perform it? I have not found any presets on Import dialog to reduce size.

    If the photos are important then get an external FW hard drive and move the library to it and operate from there. Delete the library from your MacBook.
    Next create a new library on the MB and copy only the photos that you have an immediate need for from the external library with the paid version of iPhoto Library Manager. It will copy the metadata, keywords, faces, places, and edited versions between libraries. You will a lean, mean travelin' library for the MB.
    You you add photos to the library on the MB while you're on the road you can copy them to the main library in the same manner with iPLM when you get back home.

  • How to Reduce Image Size and show upload Progress Bar

    i need to capture an image from the camera and send it to the server. however to reduce the amount of data transmitted i want to shrink the image and lower its resolution.
    I have code that currently does the following :
    UIImage *testImage = [UIImage imageNamed:@"image1.png"]; // this would come from image picker
    NSData * imageData = UIImagePNGRepresentation(testImage);
    // skipped code that showed URL string setup
    NSString *postLength = [NSString stringWithFormat:@"%d", [imageData length]];
    NSMutableURLRequest *request = [[[NSMutableURLRequest alloc] init] autorelease];
    [request setURL:[NSURL URLWithString:urlString]];
    [request setHTTPMethod:@"POST"];
    [request setValue:postLength forHTTPHeaderField:@"Content-Length"];
    [request setHTTPBody:imageData];
    NSURLConnection *conn=[[NSURLConnection alloc] initWithRequest:request delegate:self];
    1. need some way to shrink the image size to reduce data traffic
    2. need some way to indicate a progress bar as data is being transfered to the server

    1. The size is visible in the metadata panel, set the dropdown to EXIF. In addition, in the Grid, with Ctrl-J, you can set the options so that you will see the cropped size in the rectangle surrounding the photo.
    2. You cannot, in one action, upload to multiple galleries. Each upload is its own action. I don't know if there is a plug-in to let you upload from LR to 500px in one action; clearly there are plug-ins for Flickr and Smugmug and several others. There should be no need to re-import. Normally, the plug-ins I mentioned will take a TIFF, resize it according to your directions, convert to JPG and upload.

  • How to reduce image size

    Hi All,
    I am reading a tiff file using JAI,By looping the tiff file ,Each page of tiff file , i am storing each page into BufferedImage ,then i am storing it as a PNG file (each page of a tiff file).
    Tiff file is of size 2000X3000 pixels (app).
    PNG images are also of same size.
    now i want to read the png images and display it as a Button image,
    Problem is i want to reduce the size of a PNG image which is of 2000X3000 pixels to 150X200 pixels
    How can i do it
    Please help me out .
    here is my piece of code
                File file = new File("filelocationf");
                SeekableStream s = new FileSeekableStream(file);
                TIFFDecodeParam param = null;
                ImageDecoder dec = ImageCodec.createImageDecoder("tiff", s, param);
                nopages=dec.getNumPages();
                for(int i=0;i<nopages;i++)
                    RenderedImage op = dec.decodeAsRenderedImage(i);
                    PlanarImage opi = new NullOpImage(dec.decodeAsRenderedImage(i),null,OpImage.OP_IO_BOUND,null);
                    image=new BufferedImage(op.getWidth(),op.getHeight(),BufferedImage.TYPE_INT_ARGB);
                    image = opi.getAsBufferedImage();
                    ImageIO.write(image,"PNG",new File(fname+".PNG"));
               }Thank u all.

    Thank u Very much for ur reply
    i.e want i want .
    but
    how to save a image by reducing its size.
    means
    ImageIO.write(image,"PNG",new File("filename".PNG"));
    {code}
    the above line of code will create png image of BufferedImage size.
    is it possible to reduce the BufferedImage size befor we write it.
    and also tutorial link abt  "g.drawImage();" method
    Thank u All.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

  • Reduce image size in pages by cropping ??

    Hello,
    I created a pages document with a lot of masked images in it. the resulting pdf file is massive. As described in the Pages manual, I tried the reduce the image file size (format menu) and the document file size (file menu). But instead of reducing the size by deleting the the parts of the images that are covered by the mask (as written in the manual), it reduces the image resolution, which I don't want.
    Question: How can I reduce the image file size by cropping and not by reducing the resolution.
    I learnt a lot today in other forums on how to edit quartz filters, so I know how to manipulate resolution afterwards for pdf's for mail and print. Cropping images before inserting them into Pages I don't find a real option. Thank's for yor help.

    I reported it to Apple via the feedback button. I also added a little wishlist for the next version.
    I think if Pages would crop the excess parts of an image covered by a mask during the pdf export would solve the problem already because imho these not visible parts are often the reason for the massive pdf file sizes. The images are completely embedded and masked in pdf's.
    Does anybody know a pdf tool that does that? I tried PDFshrink and PDFpen so far, but they both don't.
    Would also be cool to have an Automator action that adjusts resolution via edited quartz filters and crops the invisible stuff off ...

  • Reduce image size ( un-enlarge )

    I have a digital image of a house. I want to make a Christmas tree ornament that will have a picture of just the front door. The door in a 4x6 print is about 3x4. I want to reduce that to about 2x3. I am only able to print on 4x6 paper, so I want to reduce the image size then print a 4x6 which would orobably have a large white border.
    How can I do this?

    Cliff
    1. Open picture file
    2. Access rectangular marquee tool. In the options bar, select mode:fixed size, enter w=2", h=3". Position the box with the "marching ants" to include the door.
    3. Go to Image>crop
    4. Go to Edit>copy. This puts the door on the clipboard.
    5. Open a new blank file, background white, 4X6", the size of your paper stock, and set resolution the same as that of the picture. Note that for printing it is desirable to have a resolution of 240-300px/in
    6. Go to Edit>paste
    The parameters in step #2 can be refined to reflect the actual door size.
    If you want to have a background other than white, you certainly can to this. In step #5, you can select the foreground color of your choice. Just set the foreground color chip (lower left) to the desired color.
    It is also possible to paste the selection on to a texture background, etc.
    HTH. Let us know how you make out.
    Ken

  • Camera raw reducing image size

    All of a sudden Camera Raw is automatically reducing my image sizes. I cannot figure out why. The images were shot with a Nikon 5100 if that has any value.
    The original jpg size is 15MB (jpg) and have a NEF extension.
    I've tried opening the image in Photoshop and then going through Bridge to Camera Raw, and opening the image through Bridge to Photoshop and the image gets reduced from 16 inches to 5 inches keeping 300 dpi.
    Thanks in advance.!

    The only important “image size” is pixel dimensions.
    JPGs have a JPG extension.  An NEF extension means it’s a raw file.
    Things that affect DPI/PPI and pixel dimensions are in the workflow options link at the bottom of the main ACR window, and only if you output the images to some other format in ACR.

  • Reduce image size by one column/row

    I have a image 621 x 400 what Imaq vision VI I need to use to reduce the size by 1 or 2 columns (or rows)

    Use IMAQ Extract or IMAQ Resample - that should help ...

  • Mail reduces image size when forwarding!?

    When I forward an email (I use Mail - v6.6 on 10.8.5) the image in the email becomes reduced from 556KB to 20KB which renders it unusable when received.
    Can anyone tell me where settings are to stop this happening? I want to forward full size, full res images.
    Many thanks in advance for any help offered.

    Found the answer! In Mail, at top right hand side of the message pane, there's a little drop down menu for 'Image Size'. Once you set it, it stays at that setting until you change it. It'll then stay at the setting you've changed it to until you decide to change it again. See images attached.
    Let me know how if it works for you.

  • Reducing image size in I photo 7

    I am trying to reduce the size of images in iphoto. I tried to export, but the function is greyed out an inaccessible. I tried turning off any 3rd party plug in's as suggested on another post, but that didn't work.
    the export function appears available from the top of the event menu, but when I click it, nothing happens. Help! How do I reduce file sizes?

    gahpgirl:
    Welcome to the Apple Discussions. When exporting select the format to jpg instead of Current or Original. Then you'll be able to set the quality level which will reduce the file size without affecting the picture size, i.e. pixel dimensions.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 08 libraries and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • REDUCING IMAGE SIZE - PNGOUT Vs BINCOMPILER

    Dear all,
    I reduced the size of the images using 'PNGOUT' (An application used to reduce the size of the images). After that the total size of the images is 26.2KB.
    Then I converted that images (output of PNGOUT) into one binary file using 'BinCompiler' (a software used to create binary file). Now the size of that binary file is 26.3KB.
    I don't know the reason for that. i thought, when using BinCompiler the size of the jar will be more reduced. But it is same. Another one thing, when inputing obfuscated images(output of PNGOUT) to BinCompiler, the size of the the binary file is almost same. But when inputing original images(not obfuscated), the size of binary file is reduced around 10KB.
    Please explain me, why this is happening like this and what is efficient in game development , PNGOUT, BinCompiler, or both? PLEASE INFORM ME.

    Thank you Doug.  The comments on extensive uniform blue sky vs. marked variation in color seem well taken, I'll keep this method of choosing in mind.  My goal is to create a JPG family photo archive of the highest quality images that I can make for future use by non-technical descendants (thus it will supplement the TIF archive that holds the best quality versions of the same images but that may not be usable to novices).  As I cannot anticipate exactly how the JPGs will be used, I just want them to be the best possible, while still being of a size that can be uploaded to, say, Costco (5 MB size limit) for making enlargements. 
    In general, I am often left curious as to how exactly Photoshop carries out its algorithms and how different factors influence the outcome.  So often, one read "just try different techniques and see what looks the best".  But I am always left wondering, what is the theory behind this and has it been systematically studied and worked out and published.  In so many disciplines, such as medicine, the methods of optimization has been evaluated, systematized, and fully described.  I have not yet explored what may be found in technical journals, but I'm sure much of this good stuff must be available somewhere. It would be nice to have a "How Things Work" that actually explains what Photoshop is doing under the hood.
    Thanks again.

  • Reducing image size with Preview?

    I notice that Preview's "adjust size" option can considerably reduce the size of some images i got from internet. For instance, with a 366 KB JPEG image, after clicking on adjust size, there would be a line at the bottom of the window that says: 101 KB (was 366 KB). And i know this new smaller sized image has the same quality as the original because when i compare both images at maximum zoom, i see no difference in the size, color or position of the pixels. So, does anyone know how this size reduction method can be applied simultaneously to many images or to an entire folder? Or do you know any software (preferably free) that does something similar without quality loss?
    Thanks in advance

    Then change the subsampling rate or turn it off in the PDF Optimizer.  But realize that in doing so you trade the quality for a larger size.

  • Reducing image size without reducing quality

    Hello all.
    I'm trying to learn if there is a way to reduce the size of an image in Pages without reducing the quality.  It seems that when I use the built-in command from the file menu or by control-clicking on an image, the images go soft after the reduction.  There has to be a way to keep the photos sharp without having them take up so much space.  Any tips out there?

    Best is to take the original images into Preview and:
    1 Crop them to the view in Pages
    2. Decide what resolution you want for the final size in Pages:
    300dpi for good quality printing
    150 dpi for good quality screen appearance
    72 dpi for bare minimum screen appearance
    3. If they are color photo like images, save them as .jpeg with as much quality loss as you you can tolerate
    4. If they are flat areas of color or black and white save them as compressed .tiffs
    After cropping and compression bring them back into Pages and use no compression there at all.
    Peter

Maybe you are looking for

  • Finder window disarranging folder content

    Hello All, I'm not sure why, but after I downloaded mountain lion, my finder window is acting up. Some folders appear as you can see in the printscreen below (folders and docs on top of each other), and when I right-click and select "Show View Option

  • Servlets deployment problem

    Hello, everyone! The problem that I have might sound ridiculous but I am kind of desperate because I can't make head nor tail of it. I am using Tomcat 4.0 and JDK1.3.1_01 and the problem that I am facing is the following: I have an application called

  • Can't open profile manager for mac with terminal command

    i have tried to open profile manager version 0.3.0 11/4/11 3:31 PM with every command that an extensive search has revealed. each attempt yields a "no such file or directory response"; e.g.,Last login: Tue Nov 29 00:26:23 on ttys000 Welcome to Darwin

  • Error message when I try to sync ipod

    itunes says it cannot sync to the ipod because there's no room on the ipod. I restored the ipod and there's nothing on the ipod, but itunes won't sync.

  • I cannot access the pictures on my iPhone from my PC anymore?

    For some reason I can no longer access the pictures on my iPhone from my WIndows PC.  I used to be able to navigate us explorer to the files and download them to my desktop.  A possibly related glitch is that when I connect the iPhone with the cable