Slow image processing with pixie

2024-03-03 Thread MisterDrgn
Oh, hey, how's it going? Playing around with tpix has been an interesting first nim project. Some of the things I've learned: 1. Conversion to png is slow. It's better to transmit the raw pixel data. Even better, get rid of the alpha value first, so there's less to transmit. Oh, or are you sa

Slow image processing with pixie

2024-03-02 Thread firq
Hi. I wrote tpix. I haven't updated tpix in a long time for two reasons: the first is that I bought a Macbook Air and I have mostly been using iTerm2 instead of Kitty since then, and the second is that tpix was more or less feature complete as far as I was concerned (though I have been consideri

Slow image processing with pixie

2024-02-29 Thread MisterDrgn
Thanks for the suggestions. I will play around with this over the weekend. I had considered initializing the data structure at the desired final size, but then didn't do it. I guess what happened was that the nim profiler told me this part of the code was taking up a pretty small percentage of t

Slow image processing with pixie

2024-02-29 Thread guzba
This is a much better explanation of what I was trying to say. One other tip is if you need to write raw pixels to a file, you can use the pointer + len version of writeFile along with the image.data[0].addr pointer + image.data.len * 4 byte len.

Slow image processing with pixie

2024-02-29 Thread thecryptogeek
As pointed out by guzba, using a a sequence the way you are using it here will be slow. It's a very common way to go about things if you are coming from a language like Python. A very naive way of implementing a dynamically sized array would do something like this under the hood: When you init

Slow image processing with pixie

2024-02-28 Thread guzba
That loop proc imgData(img: Image): string = for d in img.data: result.add(char d.r) result.add(char d.g) result.add(char d.b) result.add(char d.a) Run is a crazy slow way of doing this. If you just need raw RGBA values, just use i

Slow image processing with pixie

2024-02-28 Thread MisterDrgn
Thanks for pointing this out. So viu doesn't actually resize images--it simply give kitty the desired dimensions and lets kitty handle that. However, under this approach it is still necessary to 1. Load in an image 2. Extract the raw rgba values 3. Print these values to a file [NOTE: This

Slow image processing with pixie

2024-02-28 Thread treeform
We tried to make pixie really fast, I doubt your problem is with pixie speed. After looking at `viu` program in rust, sorry I don't know rust well, but it it looks like it uses the `viuer` create to actually print the image. The way it appears to do it is to write the image to a tmp file and hav

Slow image processing with pixie

2024-02-28 Thread MisterDrgn
Resizing can't be the only issue because if I tell it not to resize at all, it still takes 80-90ms, whereas the other program consistently takes 25-30ms regardless of size. ...actually, it's pretty interesting that the nim program takes 85ms with no resize, but it takes 30ms if I resize it to v

Slow image processing with pixie

2024-02-28 Thread demotomohiro
Two libraries you are comparing speed use same algorithms? There are many algorithm to resizing an image. When resizing an image to smaller size, fast algorithm samples one pixel from source image and higher quality but slower one samples multiple pixels.

Slow image processing with pixie

2024-02-28 Thread MisterDrgn
Hi all, new user here, so apologies if I'm missing something obvious, or if I'm posting this question in the wrong place. I've been playing with an old (no updates in the last two years) project on github: This is a nim program that takes an an image from a