Comments (12)
Hey @routehero!
vtt
always does "resize--to-fit" scaling. Currently, the only way to get tiles of the exact size provided is using the extend_tile
argument of vtt
: vtt:1:5:5:120:160:1
. Though I guess this is not what you want.
from imgproxy.
extend is cool, but first I'd like to ensure that every thumbnail in the tile is cropped/scaled.
Goal is to get 9:16 thumbs in the tile.
from imgproxy.
I can add an argument that would enable "resize-to-fill" scaling of the tiles, but it will always use the center of a frame (as with ce
gravity). Would it work for you?
from imgproxy.
On our site, we plan to have a feature where the user can select a 9:16 portion of a 16:9 video.
Using ffmpeg, I would do something like:
only iframes:
ffmpeg -y -skip_frame nokey -i ../bbb_sunflower_1080p_30fps_normal.mp4 -vf "fps=1/5,crop=x=0:y=0:w=ih*9/16,scale=480:640,tile=5x5" test%05d.jpg
all frames:
ffmpeg -y -i ../bbb_sunflower_1080p_30fps_normal.mp4 -vf "fps=1/5,crop=x=0:y=0:w=ih*9/16,scale=480:640,tile=5x5" test2%05d.jpg
Being able to specify the x= parameter in this case is key to the feature, so center-based gravity would not be appropriate.
from imgproxy.
Well, it's possible. But I'd rather allow specifying a focus point (like in the fp
gravity) instead of offsets. The focus point is generally easier to use and it can have proper defaults (0.5x0.5 for center). From the frontend's point of view, it's a little bit more complex but not rocket science. Basically, it can be calculated as (x_offset + selected_area_width/2) / video_width
. What do you think about this?
from imgproxy.
Sounds good to me.
from imgproxy.
I made a test build test-vtk-fill
that adds 3 additional arguments to vtt
. Now its arguments look like this:
vtt:%step:%columns:%rows:%tile_width:%tile_height:%extend_tile:%trim:%fill:%focus_x:%focus_y
fill
: when set to 1
, t
or true
, imgproxy will resize frames to fill a tile and will crop projecting parts (as with resizing_type:fill
).
focus_x
and focus_y
: floating point numbers between 0
and 1
that define the coordinates of the center of the tile. Treat 0
and 1
as right/left for focus_x
and top/bottom for focus_y
. Applicable only when fill
is used.
Please check if this does the job for you.
from imgproxy.
Initial testing looks good to me!
from imgproxy.
Nice! Please drop a line here when you make sure it works for you so I can merge this to the upstream.
from imgproxy.
Related Issues (20)
- Issue with opentelemetry endpoint that contains a path HOT 2
- Documentation does not mention that presets should be used with a `preset:` prefix in the Presets Guide HOT 1
- SVG source format doesn't work with WEBP_DETECTION and AVIF_DETECTION HOT 2
- Only first 10 parameters are pulled from AWS parameter store HOT 3
- Support deploying to Deta Space HOT 4
- Allow original image if new content-length is larger than origin content length HOT 8
- Feature request: send more data to Sentry HOT 1
- Resize images HOT 4
- Publish docker images to github container registry (ghcr.io) HOT 4
- Inconsistent status code HOT 4
- 3.23.0 causes S3 errors (works in 3.22.0) HOT 7
- Exif too large HOT 6
- Asking for Help: Nginx Configuration for Rewrites HOT 2
- ICO files failing with "Cant load from ICO" error HOT 7
- Base64 encoding of local url doesn't work HOT 1
- Resizing with "fit" mode leads to blurry images in some cases HOT 2
- invalid TIFF format: image dimensions are not specified HOT 6
- Support EPS files HOT 1
- "is not a video" error when trying to source PSD file HOT 2
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 imgproxy.