atanunq / viu

Terminal image viewer with native support for iTerm and Kitty
MIT License
2.5k stars 54 forks source link

Mirror option is not working #100

Closed i30817 closed 9 months ago

i30817 commented 2 years ago

At least for random pngs.

testcase:

#! /usr/bin/env python3

from PIL import Image
import subprocess, io

solid_black = Image.new('RGBA', (50,50), (0, 0, 0, 255))
solid_red = Image.new('RGBA', (50,50), (255, 0, 0, 255))

combined = Image.new('RGBA', (100, 50))
combined.paste(solid_black, box=(0,0))
combined.paste(solid_red, box=(solid_black.size[0],0))

#for comparasion, original
combined.show()
#for bug view
with io.BytesIO() as f:
    combined.save(f, format='png')
    #supposed to be reversed
    subprocess.run(['viu', '-m', '-'], input=f.getbuffer())
atanunq commented 1 year ago

Yeah, apparently it had been unused for a while. Apologies for the confusion. I removed any references to it in https://github.com/atanunq/viu/commit/15f9f00356275ff212ff98b2d30af8c3a761c74f but that's still not in a tagged version

deathtrip commented 1 year ago

Why remove it, instead of fixing? I think it's a cool feature.

i30817 commented 1 year ago

It has little point to be in the application, since like i've shown above, you can just invert, save to memory as 'png' and stream with a image library and a pipe, and if you 'needed' something like this it's likely you'd need a script anyway. If you're doing image manipulation, it's likely you'd need 'more' than just this feature (in my case i do a '| |E' type layout with 1 column box image and two screenshots on top of eachother on the side and different color border depending on if the images are 'new' or not - there is no way that viu would support that with just switches, certainly not without unnecessary loss of quality from repeated resizes).

Viu is not turning into imagemagik any time soon, and it's probably better for it that way. Separation of concerns.