[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

RMagick exporting pixels as string

Ilmari Heikkinen

1/7/2006 10:06:00 AM

Hi,I'm exporting pixels to an OpenGL texture from Magick::Imageusing export_pixels.The problem is that it's slow.5.5 seconds for a 330x370 image -slow.Is there a faster way to do this:image.export_pixels(0,0, cols, rows, "BGRA").pack("c*")Thanks in advance,Ilmari
3 Answers

Ilmari Heikkinen

1/7/2006 10:29:00 AM

0

On 1/7/06, Ilmari Heikkinen <ilmari.heikkinen@gmail.com> wrote:> Hi,>> I'm exporting pixels to an OpenGL texture from Magick::Image> using export_pixels.>> The problem is that it's slow.> 5.5 seconds for a 330x370 image -slow.>> Is there a faster way to do this:>> image.export_pixels(0,0, cols, rows, "BGRA").pack("c*")Did some more timing and pinpointed the problem:export-bgra: 0.557612pack: 4.761164export_pixels isn't quite the speed demon, but pack'sthe real problem.

Detlef Reichl

1/7/2006 11:48:00 AM

0

Am Samstag, den 07.01.2006, 19:29 +0900 schrieb Ilmari Heikkinen:
> On 1/7/06, Ilmari Heikkinen <ilmari.heikkinen@gmail.com> wrote:
> > Hi,
> >
> > I'm exporting pixels to an OpenGL texture from Magick::Image
> > using export_pixels.
> >
> > The problem is that it's slow.
> > 5.5 seconds for a 330x370 image -slow.
> >
> > Is there a faster way to do this:
> >
> > image.export_pixels(0,0, cols, rows, "BGRA").pack("c*")
>
>
> Did some more timing and pinpointed the problem:
> export-bgra: 0.557612
> pack: 4.761164
>
> export_pixels isn't quite the speed demon, but pack's
> the real problem.

Hi,

try image.to_blob, that will return the image data as a string.

Cheer
detlef



Ilmari Heikkinen

1/7/2006 2:05:00 PM

0

On 1/7/06, Detlef Reichl <detlef.reichl@gmx.org> wrote:> Am Samstag, den 07.01.2006, 19:29 +0900 schrieb Ilmari Heikkinen:> > On 1/7/06, Ilmari Heikkinen <ilmari.heikkinen@gmail.com> wrote:> > > Hi,> > >> > > I'm exporting pixels to an OpenGL texture from Magick::Image> > > using export_pixels.> > >> > > The problem is that it's slow.> > > 5.5 seconds for a 330x370 image -slow.> > >> > > Is there a faster way to do this:> > >> > > image.export_pixels(0,0, cols, rows, "BGRA").pack("c*")> >> >> > Did some more timing and pinpointed the problem:> > export-bgra: 0.557612> > pack: 4.761164> >> > export_pixels isn't quite the speed demon, but pack's> > the real problem.>> Hi,>> try image.to_blob, that will return the image data as a string.>> Cheer> detlefThank you so much, that did the trick.Now it's taking just 0.16s to get the pixels. Also, the image wasactually 1000x1000 pixels, brainfart on my side.(As a sidenote, Imlib2's doing the same in 0.016s.)