Hello, the attached patch add the option -j/--jpeg to enable saving as jpeg file. With this option given: - the image will be saved to jpeg file with the default jpeg options used in the gdk_save_image function. - in the file dialog the file name is presented with the 'jpg' extension. If this extension is changed to anything else, a png file will be saved. Independently. if in the file dialog the extension is set to 'jpg', the image is also saved as jpeg file. best regards, Gert
Created attachment 6405 Patch against v1.8.2, tested on Gentoo Linux.
Created attachment 6406 Patch against v1.8.2, tested on Gentoo Linux. Cleans the superfluous "Only in ... " lines
Instead of flying all around a new boolean option (what if next, someone wants to add a 'save as tiff' option ?) maybe we should un-hardcode png from the path when saving and just use the extension provided by the user in the full path ?
Well, my incentive for providing saving to jpeg was that because it uses lossy compression and therefore the files are way smaller. The command line option is there so one can change the default file type that is proposed in the save dialogue (i.e. I now use it in the command that is bound to the screenshot). Switching here from a boolean option to a string option that contains the suffix should be possible though and generalize this feature. I will see if I can provide a different patch.
I totally get the incentive, but from my experience lossless png can already be compressed/optimized, and jpeg is better suited for actual camera pictures. But fine, why not :) Note that even if the screenshot is taken as a png, uploading it to imgur will automatically degrade it and compress it to jpeg too..
Created attachment 6516 Patch against v1.8.2 to enable more image file types, tested on Gentoo Linux. This patch replaces the uoption --jpeg/-j proposed in the earlier patch by --filetype/-t and enables the user to set the output image type to any type that is supported by gdk-pixbuf.
Well, on of my uses for screen shots is to create background images from full-screen views of photos, this is easier that using gimp to cut out an image of the right size :) Back to the latest patch: I wanted to add output of a list of supported formats, but gdk_pixbuf_get_formats () reports more than the library can actually handle (e.g. svg, but later is says that the version of pixbuf doesn't support writing bitmaps to svg), so I left this out. I have tried it with jpeg, png, and tiff, and it worked. One thing one might consider is, that if the extension given in the dialogue is not supported, then the option to retry saving would probably be nice.
Nice, i'll try it.... but im still not comfortable with adding a new param for each and every function call, would be so much nicer to store the extension directly in the filename/save_uri/save_file where possible :) Something like 'if provided title has an extension, use it to figure out the filetype the user wants (eventually munge the name with timestamps/pattern if needed) otherwise default to .png'
I'm not quite sure what you mean with 'provided title', AFAIK so far you only offer a parameter that sets the output directory, and the (proposed) file name is created automatically. If you want to replace this parameter so that it also can accept a full path with a place holder for the date and file extension, fine. My idea was that the command line parameter sets the proposed file type, e.g. when you do a screen shot with a shortcut key and want to set the file type to something that is not the default (=png) without having to edit it each time in the save dialogue, and I wanted to achieve this by changing your code as little as possible. In any case I actually think that most people don't call the screenshot program from the command line, and therefore, don't care about them ;)
Sorry for being not really reactive on this, i have a broken internet connection those days; Also, this is not *my code*, i happen to apply patches now and then but most of it was done by jerome :) That said, now i understand better the usecase, so yes being able to pass the parameter around would be okay for this, and still allow an user using the GUI to set the filetype, based on the extension he'd use for the filename he types when saving the file. And i do call xfce4-screenshooter on the cli, but most of the times without arguments :)
Don't worry, from my side there is no rush - on Gentoo can easily run the patched version. I only thought that since I find it useful, maybe others will do so too, so why not send the patch upstream :)
-- GitLab Migration Automatic Message -- This bug has been migrated to xfce.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.xfce.org/apps/xfce4-screenshooter/-/issues/6. Please create an account or use an existing account on one of our supported OAuth providers. If you want to fork to submit patches and merge requests please continue reading here: https://docs.xfce.org/contribute/dev/git/start#gitlab_forks_and_merge_requests Also feel free to reach out to us on the mailing list https://mail.xfce.org/mailman/listinfo/xfce4-dev