summaryrefslogtreecommitdiffstats
path: root/resources/image.go
AgeCommit message (Collapse)Author
2021-07-15hugofs: Make FileMeta a structBjørn Erik Pedersen
This commit started out investigating a `concurrent map read write` issue, ending by replacing the map with a struct. This is easier to reason about, and it's more effective: ``` name old time/op new time/op delta SiteNew/Regular_Deep_content_tree-16 71.5ms ± 3% 69.4ms ± 5% ~ (p=0.200 n=4+4) name old alloc/op new alloc/op delta SiteNew/Regular_Deep_content_tree-16 29.7MB ± 0% 27.9MB ± 0% -5.82% (p=0.029 n=4+4) name old allocs/op new allocs/op delta SiteNew/Regular_Deep_content_tree-16 313k ± 0% 303k ± 0% -3.35% (p=0.029 n=4+4) ``` See #8749
2021-07-05exif: Log warning for metadata decode errorBrandon Woodford
see #8519
2021-06-18Split out the puthe path/filepath functions into common/pathsBjørn Erik Pedersen
So they can be used from the config package without cyclic troubles. Updates #8654
2021-06-17resources/image: Fix fill with smartcrop sometimes returning 0 bytes imagesBjørn Erik Pedersen
Fixes #7955
2021-04-15Add webp image encoding supportBjørn Erik Pedersen
Fixes #5924
2020-12-17images: Add images.Overlay filterBjørn Erik Pedersen
This allows for constructs ala: ``` {{ $overlay := $img.Filter (images.Overlay $logo 50 50 )}} ``` Or: ``` {{ $logoFilter := (images.Overlay $logo 50 50 ) }} {{ $overlay := $img | images.Filter $logoFilter }} ``` Which will overlay the logo in the top left corner (x=50, y=50) of `$img`. Fixes #8057 Fixes #4595 Updates #6731
2020-12-16all: Fix minor typosPhil Davis
2020-12-03all: Format code with gofumptBjørn Erik Pedersen
See https://github.com/mvdan/gofumpt
2020-09-15resources/image: Fix nilpointer for images with no ExifBjørn Erik Pedersen
E.g. PNG files. Fixes #7688
2020-03-02resources: Add full filename to image when processing failsBjørn Erik Pedersen
Fixes #7000
2019-12-03tpl/partials: Allow any key type in partialCachedBjørn Erik Pedersen
Fixes #6572
2019-11-25resources/images: Make the image cache more robustBjørn Erik Pedersen
Also allow timeout to be set as a duration string, e.g. `30s`. Fixes #6501
2019-10-20resources/images: Allow to set background fill colourBjørn Erik Pedersen
Closes #6298
2019-09-21resources: Support output image format in image operationsJ. Ansorg
The image format is defined as the image extension of the known formats, excluding the dot. All of 'img.Resize "600x jpeg"', 'img.Resize "600x jpg"', and 'img.Resize "600x png"' are valid format definitions. If the target format is defined in the operation definition string, then the converted image will be stored in this format. Permalinks and media type are updated correspondingly. Unknown image extensions in the operation definition have not effect. See #6298
2019-09-04Allow slices in the image Filter funcs, not just varargsBjørn Erik Pedersen
[ci skip] See #6255
2019-09-03Cache processed images by their source pathBjørn Erik Pedersen
Fixes #6269
2019-09-02resources: Cache Exif data to diskBjørn Erik Pedersen
```bash name old time/op new time/op delta ImageExif/Cold_cache-4 312µs ±28% 355µs ± 7% ~ (p=0.343 n=4+4) ImageExif/Cold_cache,_10-4 479µs ± 6% 546µs ± 0% +13.91% (p=0.029 n=4+4) ImageExif/Warm_cache-4 272µs ± 1% 81µs ± 5% -70.30% (p=0.029 n=4+4) name old alloc/op new alloc/op delta ImageExif/Cold_cache-4 151kB ± 0% 161kB ± 0% +6.46% (p=0.029 n=4+4) ImageExif/Cold_cache,_10-4 179kB ± 0% 189kB ± 0% +5.49% (p=0.029 n=4+4) ImageExif/Warm_cache-4 151kB ± 0% 13kB ± 0% -91.52% (p=0.029 n=4+4) name old allocs/op new allocs/op delta ImageExif/Cold_cache-4 1.03k ± 0% 1.21k ± 0% +17.78% (p=0.029 n=4+4) ImageExif/Cold_cache,_10-4 1.65k ± 0% 1.83k ± 0% +11.09% (p=0.029 n=4+4) ImageExif/Warm_cache-4 1.03k ± 0% 0.28k ± 0% -72.40% (p=0.029 n=4+4) ``` Fixes #6291
2019-08-31resources: Remove unused map typeBjørn Erik Pedersen
2019-08-31Add image.ExifBjørn Erik Pedersen
Note that we will probably need to add some metadata cache for this to scale. Fixes #4600
2019-08-28Add a set of image filtersBjørn Erik Pedersen
With this you can do variants of this: ``` {{ $img := resources.Get "images/misc/3-jenny.jpg" }} {{ $img := $img.Resize "300x" }} {{ $g1 := $img.Filter images.Grayscale }} {{ $g2 := $img | images.Filter (images.Saturate 30) (images.GaussianBlur 3) }} ``` Fixes #6255
2019-08-26Image resource refactorBjørn Erik Pedersen
This commit pulls most of the image related logic into its own package, to make it easier to reason about and extend. This is also a rewrite of the transformation logic used in Hugo Pipes, mostly to allow constructs like the one below: {{ ($myimg | fingerprint ).Width }} Fixes #5903 Fixes #6234 Fixes #6266
2019-03-30resources: Fix image publish ordering issueBjørn Erik Pedersen
Fixes #5730
2019-03-23Make Page an interfaceBjørn Erik Pedersen
The main motivation of this commit is to add a `page.Page` interface to replace the very file-oriented `hugolib.Page` struct. This is all a preparation step for issue #5074, "pages from other data sources". But this also fixes a set of annoying limitations, especially related to custom output formats, and shortcodes. Most notable changes: * The inner content of shortcodes using the `{{%` as the outer-most delimiter will now be sent to the content renderer, e.g. Blackfriday. This means that any markdown will partake in the global ToC and footnote context etc. * The Custom Output formats are now "fully virtualized". This removes many of the current limitations. * The taxonomy list type now has a reference to the `Page` object. This improves the taxonomy template `.Title` situation and make common template constructs much simpler. See #5074 Fixes #5763 Fixes #5758 Fixes #5090 Fixes #5204 Fixes #4695 Fixes #5607 Fixes #5707 Fixes #5719 Fixes #3113 Fixes #5706 Fixes #5767 Fixes #5723 Fixes #5769 Fixes #5770 Fixes #5771 Fixes #5759 Fixes #5776 Fixes #5777 Fixes #5778
2019-01-02resources: Move resource interfaces into its own packageBjørn Erik Pedersen