0

I have written a C++ program to perform a slide show that works perfectly sequentially and randomly on my ubuntu desktop and also on the target Raspberry Pi where the slide show should run.

This is basically the code I use to display:

#include "CImg.h"
using namespace cimg_library;
int main(int argc, char **argv) {
const char const folder = cimg_option("-i",".","Path containing pictures");
char pattern[1024];
std::snprintf(pattern,1024,"%s/.jpg",folder);
const CImgList filenames = cimg::files(pattern,true,0,true);

CImgDisplay disp(1,1,0,0,1,1);
cimglist_for(filenames,l) {
const char
*const filename = filenames[l],
*const basename = cimg::basename(filename);
const CImg img(filename);
disp.resize(cimg_fitscreen(img.width(),img.height(),1),0);
disp.display(img).set_title(basename);
if (disp.is_keyESC()) std::exit(0);
cimg::wait(3000);
}
return 0;
}"

The program runs perfectly but the pictures are not displayed full screen as I would. I presume that the reason depends from the resize disposition. I have seen the command § set_fullscreen(), but I do not achieve the solution.

What I would is that the pictures were viewed (as Ubuntu Shotwell Photo Manager or Raspberry Image Viewer do) on full screen without deformations.

I hope you could give me an example of how I should code. Thanks, Renato Rocci

Renato R
  • 1
  • 2

1 Answers1

1

Change

disp.resize(cimg_fitscreen(img.width(),img.height(),1),0);

into

disp.resize(CImgDisplay::_fitscreen(img.width(),img.height(),1,0,-100,false),
            CImgDisplay::_fitscreen(img.width(),img.height(),1,0,-100,true),0);

If you want a black background, add

CImgDisplay bg(CImgDisplay::screen_width(),CImgDisplay::screen_height(),0,0,1,0);

before

CImgDisplay disp(1,1,0,0,1,1);
Stef
  • 28,728
  • 2
  • 24
  • 52
  • I apologize for delay. Your suggestion works perfectly. Thank you very much. – Renato R Feb 01 '18 at 15:51
  • You're welcome. If this answer solved your problem it would be nice if you could [accept](https://stackoverflow.com/help/someone-answers) it. – Stef Feb 02 '18 at 20:59