[flexcoders] Re: Creating Thumbnails from large images on the fly. Possible?
Right, but you are still having to download the entire image file and just sizing it right? What I was wondering if it is possible to only donwload part of the image file like a segment, or a very low quality to save the user bandwidth. Is that possible with AS3 on the fly, or would I have to use something like imagemagik for that? --- In flexcoders@yahoogroups.com, Brian Dunphy [EMAIL PROTECTED] wrote: Definitely possible -- I do it using a function like so: public function getBitmapData(target:UIComponent, scale:Number = 0.):BitmapData { var bd:BitmapData = new BitmapData(target.width * scale, target.height * scale); var m:Matrix = new Matrix(); m.scale(scale, scale); bd.draw(target, m); return bd; } Basically what that function does, it accepts a target UIComponent to draw the thumbnail from (in my case it's usually charts, but to do what you're after you might use an Image or an SWFLoader). It also accepts a scale to upsize/downsize the bitmap to... by default it does it 1/3 of the size. Cheers, Brian On 2/22/07, joebob409 [EMAIL PROTECTED] wrote: I am wondering if it is possible with AS3 to create thumbs from large image files on the fly. Maybe only downloading partial image data and shrinking the size. Anyone know if that is possible or any alternative methods I could possibly use for this? Thanks -- Brian Dunphy
Re: [flexcoders] Re: Creating Thumbnails from large images on the fly. Possible?
I'm not sure that is possible given the nature of how data is stored in image files... maybe somebody else has some insight in to the topic. Brian On 2/22/07, joebob409 [EMAIL PROTECTED] wrote: Right, but you are still having to download the entire image file and just sizing it right? What I was wondering if it is possible to only donwload part of the image file like a segment, or a very low quality to save the user bandwidth. Is that possible with AS3 on the fly, or would I have to use something like imagemagik for that? --- In flexcoders@yahoogroups.com, Brian Dunphy [EMAIL PROTECTED] wrote: Definitely possible -- I do it using a function like so: public function getBitmapData(target:UIComponent, scale:Number = 0.):BitmapData { var bd:BitmapData = new BitmapData(target.width * scale, target.height * scale); var m:Matrix = new Matrix(); m.scale(scale, scale); bd.draw(target, m); return bd; } Basically what that function does, it accepts a target UIComponent to draw the thumbnail from (in my case it's usually charts, but to do what you're after you might use an Image or an SWFLoader). It also accepts a scale to upsize/downsize the bitmap to... by default it does it 1/3 of the size. Cheers, Brian On 2/22/07, joebob409 [EMAIL PROTECTED] wrote: I am wondering if it is possible with AS3 to create thumbs from large image files on the fly. Maybe only downloading partial image data and shrinking the size. Anyone know if that is possible or any alternative methods I could possibly use for this? Thanks -- Brian Dunphy -- Brian Dunphy
Re: [flexcoders] Re: Creating Thumbnails from large images on the fly. Possible?
I don't think this is possible, you need server side code of some sort to give you the thumbnail image. You might be able to initiate the loading of the file and halt it mid-way, then try to render the partially loaded data as an image, but that's going to be difficult (especially depending on what image format you're using). You'd probably have to do the byte to image pixel processing yourself. And the only thing that might get you if you could figure it out, is you might be able to load the first X pixels of the image, so maybe you could show the top-half of each image only, and only have to load half the bytes of each image. But if you want to load a smaller file you'll have to send a smaller file from the server. On 2/22/07, Brian Dunphy [EMAIL PROTECTED] wrote: I'm not sure that is possible given the nature of how data is stored in image files... maybe somebody else has some insight in to the topic. Brian On 2/22/07, joebob409 [EMAIL PROTECTED] joebob409%40yahoo.com wrote: Right, but you are still having to download the entire image file and just sizing it right? What I was wondering if it is possible to only donwload part of the image file like a segment, or a very low quality to save the user bandwidth. Is that possible with AS3 on the fly, or would I have to use something like imagemagik for that? --- In flexcoders@yahoogroups.com flexcoders%40yahoogroups.com, Brian Dunphy [EMAIL PROTECTED] wrote: Definitely possible -- I do it using a function like so: public function getBitmapData(target:UIComponent, scale:Number = 0.):BitmapData { var bd:BitmapData = new BitmapData(target.width * scale, target.height * scale); var m:Matrix = new Matrix(); m.scale(scale, scale); bd.draw(target, m); return bd; } Basically what that function does, it accepts a target UIComponent to draw the thumbnail from (in my case it's usually charts, but to do what you're after you might use an Image or an SWFLoader). It also accepts a scale to upsize/downsize the bitmap to... by default it does it 1/3 of the size. Cheers, Brian On 2/22/07, joebob409 [EMAIL PROTECTED] wrote: I am wondering if it is possible with AS3 to create thumbs from large image files on the fly. Maybe only downloading partial image data and shrinking the size. Anyone know if that is possible or any alternative methods I could possibly use for this? Thanks -- Brian Dunphy -- Brian Dunphy
Re: [flexcoders] Re: Creating Thumbnails from large images on the fly. Possible?
Best way to do it is to have some sort of server process that scales the image and store that scaled version for future requests. I had built a system quite a while ago for doing Image Management and it would scale multiple sizes of each image on upload and then you can download the appropriate size as needed. Much like how flickr works. We built it in java. If you can run java I can try and dig up some of the code. I'm not sure that is possible given the nature of how data is stored in image files... maybe somebody else has some insight in to the topic. Brian