Commit Graph

53 Commits

Author SHA1 Message Date
94b1e98767 plug-ins: WebP: save_dialog() before gimp_export()
As mentioned in issue #1777, exporting non-animated WebP images was
only keeping the current layer.
Mimick file-gif-save.c: display the encoding settings pop-up earlier
so that gimp_export_image() can merge the layers unless "As Animation"
is enabled. Call gimp_image_get_layers() directly in save_image() in
case the layers were merged (for clarity because layers are used only
for animations).

(cherry picked from commit 8f828d1899)
2019-12-21 10:20:33 +01:00
a02958c5ce Missing mnemonics on several file dialogs
This path corrects missing mnemonics on several save/open/export dialogs.

save: file
open: file, dds, fits, tiff
export: bmp, dds, fli, gbr, gih, mng, pat, pnm, pdf, raw, sunras, sgi, webp
2019-09-05 12:46:14 +00:00
0806588b56 Issue #3532 - Wrong color profile on nikon taken photos, it's...
...always AdobeRGB!

Change all file plug-ins to never call gimp_image_metadata_load_finish()
with the GIMP_METADATA_LOAD_COLORSPACE when they loaded a color profile.

This keeps gimp_image_metadata_load_finish() from assigning a profile
from DCT even if the loaded profile was GIMP's built-in sRGB.

(cherry picked from commit a08293dc74)
2019-06-25 13:22:47 +02:00
e7cd743b05 plug-ins: simplify code a bit by removing useless variable.
(cherry picked from commit 8cd3f5a853)
2019-06-07 19:06:40 +02:00
bb9571db60 plug-ins: remove the "Advanced Options" expander in WebP export dialog.
Similarly to other export dialogs, we don't consider anymore metadata or
profile writing as being advanced options. Since these were the only
options shown in our current WebP export dialog, I removed the expander
altogether and moved everything out.

See also commit 540cfa9611.

(cherry picked from commit 26ba915ca5)
2019-06-07 19:02:04 +02:00
5c8860bd49 plug-ins: fix profile writing in save_animation() in WebP export.
Profile and output linearity decision was doubled as save_layer() and
save_animation() and I realize that I forgot to update the
save_animation() one in earlier commits.

To avoid code copy-paste and divergence, I added an internal
webp_decide_output() function which I use in both aforementionned calls.

(cherry picked from commit 6712228e5e)
2019-06-07 19:01:56 +02:00
0aad97cc18 plug-ins: add a "Save color profile" checkbox in WebP export.
Unlike most other formats, it didn't have one yet!

(cherry picked from commit 96e37dfdaf)
2019-06-07 19:01:49 +02:00
1bdac39a92 plug-ins: improve decision on exported data format in Webp.
Same as other formats, we make sure that an explicitly set profile TRC
is always followed. When no profile is set, we always export as sRGB
when there is precision downsizing to avoid shadow posterization, since
WebP stores 8-bit max per channel (as far as I know, or at least as far
as we implemented it in our plug-in).
We only take the storage format into account when it is 8-bit linear
with profile export. In such case, we avoid conversion from 8-bit linear
to 8-bit sRGB.

This is different to TIFF export for instance, where we fallback on
following storage format TRC as we are able to export all sort of
precisions, hence with minimum quality loss.

(cherry picked from commit 2a1eabc177)
2019-06-07 19:01:34 +02:00
d1d0022500 plug-ins: export linear WebP if and only if the work image was 8-bit...
... linear itself AND if we export the profile.
Implement similar logics to WebP export as I did to JPEG in my previous
commit.

(cherry picked from commit b9458f8a6e)
2019-04-15 23:54:51 +02:00
bfe24a3b50 Issue #3253: exporting to webp from 32-bit float linear image...
... produces incorrect result.
Similar to previous fixes to JPEG and PNG exporters. Here WebP always
export 8-bit per channel colors, so let's always keep it non-linear.
Simply when the original data was linear, if we save the profile,
convert it to sRGB before exporting.

(cherry picked from commit 7a4b313b12)
2019-04-15 17:53:37 +02:00
66c47ee23f plug-ins: do not needlessly free/malloc() buffer of same size.
In an animated WebP, chances that layers/frame have the same size is
high. It is uneeded to free then malloc again a buffer at each frame,
unless we need more allocated memory.
This is probably not so significant, but still feels nicer.

(cherry picked from commit 0b68ce8182)
2019-03-19 12:54:13 +01:00
Ell
2dad85b84f libgimpwidgets, app, plug-ins: use GimpSpinButton everywhere
Replace all direct uses of GtkSpinButton with GimpSpinButton, so
that its modified behavior extends to all our spin buttons.
2019-03-09 07:43:13 -05:00
741a659a12 webpmux: fix memory leak by calling WebPMuxDelete()
(cherry picked from commit e9200d2c00)
2018-12-07 00:51:13 +01:00
79961a6545 plug-ins: install plug-ins in subfolder.
I am going to forbid plug-ins from being installed directly in the root
of the plug-ins/ directory. They will have to be installed in a
subdirectory named the same as the entry point binary.
This may seem useless for our core plug-ins which are nearly all
self-contained in single binaries, but this is actually a necessary
restriction to eliminate totally the DLL hell issue on Windows. Moving
core plug-ins in subfolders is only a necessary consequence for it.

(cherry picked from commit 870ca6334d)
2018-08-16 13:25:51 +02:00
a88c0ffb93 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:47:19 +02:00
147c09f19e Bug 795161 - Misc. typo fixes in source comments and doxygen
Found via `codespell`
Follow-up to  commit 7fdb963e01
2018-04-18 21:06:57 +02:00
82f6baf2bb plug-ins: file export should follow preferences regarding metadata.
Various plug-ins exporting metadata should now follow preferences, which
would override any default. Of course these preferences can still be
overriden by saved settings (global parasite), previous run settings,
and finally through the GUI when interactive.
2018-01-11 22:17:32 +01:00
096debb0fd Bug 790552 - do not save metadata by default.
This is a privacy concern. Whereas importing metadata is usually a good
idea, exporting it should be a conscious action. A lot of private data
can be leaked through metadata and many people don't realize it (which
also usually means they don't need it). On the other hand, the people
who realize it are the ones who would explicitly edit the metadata and
check what they want to be exported or not.

This is only a first step. Some people may want to always export the
metadata and for these people, there should be abilities to change the
default.
2018-01-11 00:39:22 +01:00
317f7fa5ca Bug 791514 - Cannot export to webp file.
fopen() modes "wb+" and "w+b" are aliases of the same opening mode
(truncate/create in binary read/write). But it turns out that Windows
implementation does not understand "wb+". The alias "w+b" works fine in
my tests.
2017-12-22 19:25:11 +01:00
10d80a6ced plug-ins: try to get more human-readable information on why g_fopen()...
... failed.
See bug 791514. It seems that the file opening fails for webp exporting,
but the error string is not informative enough.
As a general rule, we should have as informative errors as possible.
2017-12-17 16:47:00 +01:00
e16c8a2352 Move the new "default_new_layer_mode" APIs to the image...
...in both the core and libgimp.

Images now know what the default mode for new layers is:

- NORMAL for empty images
- NORMAL for images with any non-legacy layer
- NORMAL_LEGAVY for images with only legacy layers

This changes behavior when layers are created from the UI, but *also*
when created by plug-ins (yes there is a compat issue here):

- Most (all?) single-layer file importers now create NORMAL layers
- Screenshot, Webpage etc also create NORMAL layers

Scripts that create images from scratch (logos etc) should not be
affected because they usually have NORMAL_LEGACY hardcoded.

3rd party plug-ins and scripts will also behave old-style unless they
get ported to gimp_image_get_default_new_layer_mode().
2017-08-21 20:18:00 +02:00
838449254a plug-ins: use gimp_get_default_new_layer_mode() for most new layers
instead of hardcoding NORMAL_LEGACY.
2017-08-20 17:12:46 +02:00
aa3bc36c01 plug-ins: WebP kmax hint text not properly displayed for origin value.
The hint text was shown on kmax change, but not when it was 0 or 1 from
start (i.e. when previous export was 0/1 so these were the saved
values). Run the callback upon construction to initialize properly this
hint label.
2017-08-01 19:39:35 +02:00
bfc301e2f9 plug-ins: help text for special values of kmax.
Since libwebp 0.6, the keyframe max distance (kmax) has been changed,
and in particular all special cases are now handled by kmax (it used to
be weird cases of kmin and kmax intertwined with no logics, for instance
kmax == 0 AND kmin > 0 would mean all frames are keyframes).
Now it is much more logical, and kmax == 0 means no keyframes, whereas
kmax == 1 means all frames are keyframes. See also:
2dc0bdcaee
2017-08-01 18:31:14 +02:00
3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
66060e3307 app, libgimp*, plug-ins: replace enum GimpLayerModeEffects by GimpLayerMode
with proper value names. Mark most values as _BROKEN because they use
weird alpha compositing that has to die. Move GimpLayerModeEffects to
libgimpbase, deprecate it, and set it as compat enum for GimpLayerMode.
Add the GimpLayerModeEffects values as compat constants to script-fu
and pygimp.
2017-01-08 23:00:19 +01:00
136ef67b64 Bug 775026 - webp-save: expose more saving options in the UI
webp-save: Add UI elements for 'minimize size' toggle, and a dependent
'max key-frame distance' setting.
* If 'minimize size' is active, max-kf is disabled (which is equivalent to
  setting it to infinity). Key-frame cost file size, that's why.
* If 'minimize size' is disabled, you get to choose how far key-frames
  (=cue points) will be inserted at max.
2016-11-26 00:55:19 +01:00
c5edf05cf0 plug-ins: code cleaning and improved error handling.
- WebPPictureImportRGB(A)() docs say these functions return "false in
  case of memory error". Handle such cases.
- status was not updated when WebPEncode() would fail in save_layer().
- gegl_buffer_flush() is unnecessary just before last unref-ing GEGL
  buffers. This is done automatically at destruction.
- Destroy resources at the same level as they were created if possible.
  This makes the code more readable and maintainable. Consequently
  better not unref parameter GEGL buffers inside combine_buffers().
- Some minor formatting cleanup.
2016-11-23 20:13:13 +01:00
4f67b16dad Bug 774472 - animated-webp: saved layers are not alpha-composited before compression
when saving as animated-webp, use Gegl:over to composite current layer
with the previous frame if needed.
2016-11-23 20:13:13 +01:00
cc12c3a0d7 plug-ins: lots of cleanup in file-webp-dialog.c 2016-11-15 01:39:38 +01:00
4c1cb9a84b plug-ins: rename "Preset" to "Source type" in WebP export dialog.
The "Preset" feature changes encoding parameters not exposed in our GUI.
Thus it looks like the option is broken as whatever you select, nothing
is updated in the export dialog.
This is also inconsistent with what we call presets in the rest of GIMP:
they are used to save and load values for all fields as a dynamic and
editable list (whereas here that's a pre-defined list in libwebp setting
only a subset of options).

`cwebp` manual defines "preset" as: "Specify a set of pre-defined
parameters to suit a particular type of source material."

Thus call the field "Source type" and add a tooltip "WebP encoder preset"
so that people don't expect a way to save settings whereas the ones used
to the WebP encoder parameters still find their way.
2016-11-15 01:11:37 +01:00
700da2a0f8 plug-ins: re-apply some of Jehan's cleanups 2016-11-15 00:25:20 +01:00
1afa322c57 Bug 773450 - Animated WEBP images should be able to set frame delay...
...in the export dialog

- change the *preset field to a proper enum
- clean-up some code related to preset
- change the UI dialogs to use a GimpIntComboBox
- misc style fixes
- quite modified by mitch to be much less code
2016-11-15 00:23:25 +01:00
f57a61cdbf Revert "Bug 773450 - Animated WEBP images should be able to set frame delay.."
This reverts commit 9ac455f4ad.
2016-11-15 00:23:15 +01:00
d9da211f9d Revert "plug-ins: various fixes and nitpicking to file-webp."
This reverts commit 58e6f6ca35.

Sorry, I have a patch that gets rid of most code from the original patch.
Will re-apply some of your cleanups later.
2016-11-15 00:22:30 +01:00
58e6f6ca35 plug-ins: various fixes and nitpicking to file-webp.
- get_preset_from_id() was defined in file-webp-dialog.c but used in
  file-webp.c only. Move it there.
- Make the preset list available in file-webp-save.h header (since it
  is specifically an encoder attribute) as static, because it is used
  both in the dialog ("preset" choice list) and the main file (for match
  of the "preset" parameter as internal ID to a WebPPreset when run as
  non-interactive).
- Generate the "preset" parameter description from the preset list.
  This way, even if this list were to change (in some hypothetical
  future), the description (and in particular the list of possible
  values and their int match) won't end up wrong.
- "enum WebPPreset" is typedef-ed to "WebPPreset".
- Use G_N_ELEMENTS to compute length of arrays on the stack (equivalent
  to the current code but shorter and simpler to read).
- Many formatting fixes.
2016-11-14 23:50:26 +01:00
9ac455f4ad Bug 773450 - Animated WEBP images should be able to set frame delay..
- change the *preset field to a proper enum
- clean-up some code related to preset
- change the UI dialogs to use a GimpIntComboBox.
- misc style fixes
2016-11-14 23:50:26 +01:00
5e6a1083fd Bug 773450 - Animated WEBP images should be able to set frame delay...
...in the export dialog

Read back timestamps into layer names. Adds the exact duration to the
layer names. Previously, they were not reloaded correctly.
2016-11-14 23:30:14 +01:00
294d92250c plug-ins: fixing error popup when canceling webp export.
Even when the export dialog does not end as success, we must cleanly
exit the plugin by setting the return values.
2016-11-08 03:48:49 +01:00
8fdee80ff8 plug-ins: clean and fix webp export.
- Default parameters must be set before gimp_get_data(). Otherwise
  when you export the first time, you end up with broken defaults
  (basically everything to 0, in particular a problem with quality
  values of 0 which makes an export failure).
- Some minor formatting here and there and an unused variable.
2016-11-08 01:39:32 +01:00
d516f9bef8 Bug 773450 - Animated WEBP images should be able to set frame delay.
animated webp saving: parse time-stamp from layer_name (instead of using
default value of '100')

also:
- add a default delay field to UI, in case time-stamps are not present.
- add a 'force delay' checkbox
- revamp the whole UI to look like the GIF saving UI.
2016-11-08 01:32:49 +01:00
26a6a39b6b fix animation layer order when saving as webp 2016-10-25 16:43:01 +02:00
342c602546 Bug 771012 - Improve WebP animation-saving
WebP saving: various improvements in file-webp-save.c

- reorganizes the main loop
- fixes (temporarily) the bad timestamp by using fixed 100ms delay between frames
- fixes the progress bar
- takes care of resource clean-up for some previously unchecked error paths
- uses 'minimize_size' and 'allow_mixed' options more appropriately
- only remuxes the final bytestream when ICC profile is present. For
  most common case, we insert the loop-count information during muxer
  creation instead of by remuxing at the end.
2016-09-11 20:36:43 +02:00
4df9a1d568 Get rid of gtk_misc_set_alignment(label) and use gtk_label_set_x,yalign() 2016-09-08 19:11:20 +02:00
252da1bdd5 Bug 769960 - animated WebP loader is not properly handling blending...
...and transparency

Use most recent API for decoding WebP animation. WebPAnimDecoder
handles transparency and blending automatically.
2016-09-04 18:56:57 +02:00
e4ecba584a plug-ins: lots of cleanup and fixes in file-webp
- handle all sorts of image types, gegl_buffer_get() will convert to u8
- specify GIMP_EXPORT_CAN_HANDLE_LAYERS_AS_ANIMATION
- modify the export duplicate, not the original image
- fix handling of the drawable type and only save "R'G'B'A u8"
  or "R'G'B' u8", fixes bug 770664.
- completely redo run(SAVE_PROC) to deal with export correctly
- turn global variables into the standard SAVE_PROC, PLUG_IN_BINARY etc
  defines
- simplify the save dialog
2016-09-04 17:57:52 +02:00
d13bc78a95 plug-ins: remove accidentially added .orig file 2016-08-22 09:06:25 +02:00
05e4c5fe28 Bug 769871 - Adds selection to save exif/xmp when exporting a webp file.
This adds an expander to the webp file plug-in  to select whether
to save or not the exif, and xmp data for webp files. This harmonizes
the plug-in with a similar option to the jpg/png file plug-ins.

https://bugzilla.gnome.org/show_bug.cgi?id=769871
2016-08-16 16:49:57 -04:00
7663ff289f plugin: fix for errors during export of webp animation with file-webp plugin
This fixes an error during export of webp animations when the layer is size smaller than the image size.

https://bugzilla.gnome.org/show_bug.cgi?id=769872
2016-08-16 16:34:09 -04:00
e4a2f220e0 Bug 769959 - crash during WebP file loading
WebPDataClear() was called on already-free'd data.
2016-08-16 03:11:26 +02:00