Commit Graph

57 Commits

Author SHA1 Message Date
Jehan 9d54d81a8c plug-ins: get rid of babl_format() in file-webp.
Same as commit 74abdfa377, this time for file-webp.
2019-07-17 13:55:19 +02:00
Jehan ee9be7fe39 plug-ins: space invasion in WebP export. 2019-07-01 00:13:18 +02:00
Michael Natterer a08293dc74 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.
2019-06-20 18:08:59 +02:00
Jehan 8cd3f5a853 plug-ins: simplify code a bit by removing useless variable. 2019-06-07 18:12:58 +02:00
Jehan 26ba915ca5 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.
2019-06-06 16:06:59 +02:00
Jehan 6712228e5e 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.
2019-06-06 16:03:18 +02:00
Jehan 96e37dfdaf plug-ins: add a "Save color profile" checkbox in WebP export.
Unlike most other formats, it didn't have one yet!
2019-06-06 15:29:07 +02:00
Jehan 2a1eabc177 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.
2019-06-06 15:22:58 +02:00
Jehan b9458f8a6e 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.
2019-04-15 23:52:53 +02:00
Jehan 7a4b313b12 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.
2019-04-14 22:18:36 +02:00
Jehan 0b68ce8182 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.
2019-03-19 12:46:12 +01:00
Ell 8954d1f386 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:28:52 -05:00
Skal e9200d2c00 webpmux: fix memory leak by calling WebPMuxDelete() 2018-11-28 13:37:39 +01:00
Michael Natterer 5f700549e7 Change the license URL from http://www.gnu.org/licenses/ to https:// 2018-07-11 23:29:46 +02:00
Michael Natterer 80997a8646 Remove most GTK_ADJUSTMENT() and (GtkAdjutment *) casts
they are obsolete in GTK+ 3.x because GtkAdjustment cannot be passed
around as GtkObject any longer, GtkObject is gone.
2018-06-24 18:15:16 +02:00
Jehan 870ca6334d 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.
2018-05-20 21:06:35 +02:00
Simon Budig 7d64cf62c6 libgimpwidgets: rename the _grid()-Variants of gimp_scale_entry_*
Adjust all plugins to follow accordingly.

This concludes the GtkTable'ocide.
2018-05-20 21:06:35 +02:00
Simon Budig 1655400e76 file-webp: kill GtkTable 2018-05-20 21:06:34 +02:00
Michael Natterer a6948b4ba5 plug-ins: s/GtkObject/GtkAdjustment/ in file-wepb 2018-05-20 21:06:29 +02:00
luz.paz 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
Jehan 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
Jehan 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
Jehan 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
Jehan 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
Michael Natterer 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
Michael Natterer 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
Jehan 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
Jehan 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
Michael Natterer 3cf423f0cd *: rename NORMAL to NORMAL_LEGACY and NORMAL_LINEAR to NORMAL
and make NORMAL_LEGACY immutable.
2017-02-26 16:26:34 +01:00
Michael Natterer 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
Pascal Massimino 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
Jehan 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
Pascal Massimino 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
Michael Natterer cc12c3a0d7 plug-ins: lots of cleanup in file-webp-dialog.c 2016-11-15 01:39:38 +01:00
Jehan 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
Michael Natterer 700da2a0f8 plug-ins: re-apply some of Jehan's cleanups 2016-11-15 00:25:20 +01:00
Pascal Massimino 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
Michael Natterer 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
Michael Natterer 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
Jehan 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
Pascal Massimino 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
Pascal Massimino 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
Jehan 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
Jehan 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
Pascal Massimino 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
Pascal Massimino 26a6a39b6b fix animation layer order when saving as webp 2016-10-25 16:43:01 +02:00
Pascal Massimino 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
Michael Natterer 4df9a1d568 Get rid of gtk_misc_set_alignment(label) and use gtk_label_set_x,yalign() 2016-09-08 19:11:20 +02:00
Pascal Massimino 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
Michael Natterer 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