Schroedinger-Hat / ImageGoNord-pip

A tool that can convert your rgb images to nordtheme palette
https://ign.schroedinger-hat.org
GNU Affero General Public License v3.0
172 stars 13 forks source link

Added video conversion support #13

Closed 05Alston closed 1 year ago

05Alston commented 1 year ago

To try the conversion,

from ImageGoNord import NordPaletteFile, GoNord

go_nord = GoNord()

go_nord.convert_video(input_file, palette_name, number_of_frames_in_batch)

A higher number of frames per batch means more memory consumption but faster execution as there'll be less parts to merge.

On the first execution, a nord.npz color map file will be generated for faster execution.

TheJoin95 commented 1 year ago

Hi, thanks for adding the video support, overall it's looking super! I added couple of comments on the debug messages.

I see there are some part hardcoded with Nord palette: we would like to extend this also to other palettes, do you think it would be possible?

Could I ask you to add a demo video in your PR description, and also update the readme by specifying this usage (and add the demo video). Thanks!

05Alston commented 1 year ago

I see there are some part hardcoded with Nord palette: we would like to extend this also to other palettes, do you think it would be possible?

I've replied to this in the above comment .

update the readme by specifying this usage (and add the demo video).

Updated the README file

PS:

For some reason ffmpeg is refusing to convert to gif files directly. I'm looking to fix this issue. Also, I've coded the code to only give mp4 as output.

Demo:

Original luffy

Converted

https://github.com/Schrodinger-Hat/ImageGoNord-pip/assets/89850018/8abb8ae9-e639-4d63-bada-41fc955fb456

Original

https://github.com/Schrodinger-Hat/ImageGoNord-pip/assets/89850018/793e9f1f-c0a6-42fc-afbb-6eeffe77ca3e

Converted

https://github.com/Schrodinger-Hat/ImageGoNord-pip/assets/89850018/2953b727-5d16-4978-af47-4a0d986fc197

05Alston commented 1 year ago

For some reason ffmpeg is refusing to convert to gif files directly. I'm looking to fix this issue

Fixed this issue as well.

The code to run the above program would be

from ImageGoNord import NordPaletteFile, GoNord
go_nord = GoNord()
go_nord.convert_video(
    input_file, 
    "nord",  #color palette name
    _frames_per_batch = 200 #optional parameter
)
TheJoin95 commented 1 year ago

We should also update the image-go-nord-cli repository with these changes. I think I'm going to take the image-go-nord web repository, @Wabri @05Alston would you like to take the CLI?