Piping ppm image to eog image viewer not working

百般思念 提交于 2020-01-16 00:53:12

问题


I am working on an image processing project in C++. To display the images I want to use the default ubuntu image viewer (eog). I have functions in my Image16 class which can read and write PPM files. I know these work because I can write them to the hard disk and then open them with eog. However I do not want to be writing the images to my hard disk because I have an SSD and each image is about 100 Mb. I want to directly pipe the image data into eog. This however is generating an error and I am not sure why.

ifstream in("/home/chase/Desktop/moon.ppm");
Image16 img = Image16::read_ppm(in);
in.close();

FILE* f = popen("eog /dev/stdin", "w");
img.write_ppm(f, 255);
pclose(f);

I managed to get it to work with imagemagick display and feh but I really don't like those programs. I want to use eog if possible.

来源:https://stackoverflow.com/questions/29731836/piping-ppm-image-to-eog-image-viewer-not-working

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!