Git Product home page Git Product logo

Comments (4)

livibetter avatar livibetter commented on July 19, 2024

The problem looks like in this:

void
gib_imlib_save_image_with_error_return(Imlib_Image im, char *file,
                                       Imlib_Load_Error * error_return)
{
   char *tmp;

   imlib_context_set_image(im);
   tmp = strrchr(file, '.');
   if (tmp)
      imlib_image_set_format(tmp + 1);
   imlib_save_image_with_error_return(file, error_return);
}

The listed formats are all lower cases in imlib, I didn't check if imlibs would do anything to format string, I guess it's just do a simple compare, therefore "JPG" still != "jpg".

Here is a quick fix:

diff --git a/src/slideshow.c b/src/slideshow.c
index 6d39d2c..fb1fcc3 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -472,7 +472,8 @@ void slideshow_save_image(winwidget win)
    if (!opt.quiet)
        printf("saving image to filename '%s'\n", tmpname);

-   gib_imlib_save_image_with_error_return(win->im, tmpname, &err);
+   imlib_context_set_image(win->im);
+   imlib_save_image_with_error_return(tmpname, &err);
    if (err)
        im_weprintf(win, "Can't save image %s:", tmpname);

According to the imlib doc,

EAPI void imlib_image_set_format ( const char * format )

Sets the format of the current image. This is used for when you wish to save an image in a different format that it was loaded in, or if the image currently has no file format associated with it.

I believe it has format associated already and it's same format as the original file, therefore those two lines have enough information for imlib to save image. I tested with JPG and PNG, I did get the saved files.

from feh.

cykerway avatar cykerway commented on July 19, 2024

Tested and it works. Great. But are you sure that the format is always associated? If so, I think the function gib_imlib_save_image_with_error_return can be trimmed into 2 lines... Maybe the author can merge this into the master branch. Close it.

from feh.

livibetter avatar livibetter commented on July 19, 2024

No, I am not sure. That's why I said "I believe." ;)

derf will review this. Maybe it's better to get to fix this (gib_imlib_save_image_with_error_return()) in giblib (but I don't feel it's still active), because there's the reason to use giblib, though you can directly call imlib to do the job.

from feh.

derf avatar derf commented on July 19, 2024

I'll merge the patch for now.

It should be fixed in giblib, but it was created by the same author as feh, so it's unmaintained right now. And I don't think that particular bugfix is relevant for the two or three other existing programs using giblib.

Yet again, thanks for the patch :)

from feh.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.