Comments (10)
@reagle I was having the same issue and came up with this small hack that works for most images tall or stout. :-)
width, height = img.size img = img.crop( (0, -int(float(height/2)), width, height) )
you could add this code after line 116 in the image.py file. working on a way to specify the crop position in the config settings.
from sigal.
The img_processor
setting can be used to specify the processor class. Pilkit provides several processors but it also possible to write a custom one (instead of hacking sigal's code ;-)) or inherit from a processor to modify its behavior.
http://pilkit.readthedocs.org/en/latest/#processors
https://github.com/matthewwithanm/pilkit/blob/master/pilkit/processors/resize.py
The default processor is ResizeToFit
, but maybe SmartResize
can give better results.
https://github.com/matthewwithanm/pilkit/blob/master/pilkit/processors/resize.py#L82
from sigal.
@saimn looks simple. did you see my new feature request? could use some pointers
#82
from sigal.
SmartResize
is hit or miss, makes some portraits better, others worse. I can't find evidence of pilkit detecting faces. @saimn which source file would you suggest a new class be added to?
from sigal.
@reagle you mean to add a new processor to sigal ? or a custom one ? In the first case, everything is in the image.py
file, in the second case you add it directly in your config file.
from sigal.
i would suggest closing this issue: yes, SmartResize
is hit and miss, but there isn't much that can be done about this in Sigal itself. this is a pilkit problem, and should be reported there.
oh, and maybe this would be less of a problem if #315 was fixed...
from sigal.
SmartResize
was one possible solution. I think it'd still make sense to adopt @hyperking's approach.
from sigal.
I realize now that an option was added in #263 to specify how thumbnails are cropped (the thumb_fit
and thumb_fit_centering
settings). This allows to crop from the top of the image, so I think the issue can be closed.
from sigal.
Oh, and just to clarify things, thumbnails are created directly with Pillow, so not using pilkit's processors:
https://github.com/saimn/sigal/blob/master/sigal/image.py#L139-L155
from sigal.
Ah, I had not noticed the thumb_fit_centering
, thanks!
from sigal.
Related Issues (20)
- Does sigal work on mkv h265 files? HOT 8
- git main fails 31 tests HOT 3
- Encrypt plugin: Password field hidden behind pictures. HOT 2
- Using galleria theme causes empty whitespace in the base index page HOT 2
- Sigal not found HOT 2
- Problems with UTF8 characters on folders HOT 1
- 2.3: Issues with tests HOT 2
- Can't decrypt an encrypted gallery HOT 2
- tests fail with pillow release 10.0.0 HOT 8
- Some files have failed to be processed HOT 5
- KeyError: '.png'
- ImportError: cannot import name 'get_terminal_size' from 'click' HOT 3
- Album with hundreds of thumbnails crash Safari on iOS devices HOT 3
- 2.4: Themes are not installed, leading to failing tests HOT 5
- Fatal error: This version of Galleria requires classic theme version 1.6 or later HOT 1
- Changes to the log level only affect the 'sigal' logger HOT 3
- Document sort order options HOT 3
- left/right arrows even when using a touchscreen HOT 1
- mode for updating a single (sub-)album HOT 1
- boto should be removed from optional dependencies HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sigal.