Commit Graph

48 Commits

Author SHA1 Message Date
vavallee e120b7f2dd Stop image endpoints from upscaling beyond the source resolution
ImageHelper.GetNewImageSize passed the caller-supplied width/height straight
through to SkiaEncoder.EncodeImage, which allocates an SKImageInfo of exactly
that size. Nothing bounded those values against the source image, so a request
like Items/<id>/Images/Primary?width=23100&height=23100 made the server allocate
and resample a 23100x23100 surface from, say, a 600x336 poster: the reporter
measured 100% of a core for 10-15 minutes and 6-12 GB resident per request.
The item images endpoints do not require authentication, so any caller who knows
an item id can trigger this, and varying the size by one pixel misses the cache
every time.

Add DrawingUtils.ScaleDownToFit, which scales a size down uniformly until it
fits inside a bounding box and returns it unchanged if it already does, and
apply it in GetNewImageSize against the original image dimensions. Requests
that ask for more pixels than the source now get the source resolution back,
scaled to the requested aspect ratio. Downscaling paths are untouched, and
DrawingUtils.Resize keeps its existing behaviour for the transcoding callers in
EncodingJobInfo and StreamInfo, which legitimately size video output.
ResizeFill already refused to upscale; this makes width/height consistent
with fillWidth/fillHeight.

Fixes #17056.
2026-08-07 12:33:37 -03:00
Thomas Jones 378ba937b6 Added in pragma warning disable for CA1815 warning.
Co-authored-by: Derpipose <90276123+Derpipose@users.noreply.github.com>
2025-09-23 13:17:52 -06:00
Bond-009 7684986fa1 Use MediaTypeNames where possible (#13440) 2025-01-26 21:06:24 -07:00
Cody Robibero a8a9f66878 standardize docs 2024-02-28 17:39:09 -07:00
Cody Robibero c5e723bccd Add support for converting from svg to other image types 2024-02-28 09:56:02 -07:00
Bond_009 c707baed83 Jellyfin.Drawing minor improvements
Reduce duplicate/dead code
2023-10-08 17:10:04 +02:00
Bond_009 c7d50d640e Replace == null with is null 2022-12-05 15:00:20 +01:00
Negulici-R. Barnabas d3580f25da fixed namescope for ImageResolution enum; 2022-11-14 16:57:30 +02:00
Negulici-R. Barnabas 2036f58b18 added associated value to ImageResolution enum; 2022-11-14 16:48:45 +02:00
Negulici-R. Barnabas 7db1813cc8 changed ChapterImageResolution in model to enum type;
added 144p to the ImageResolution enum;
updated chapters limit comment inside FFProbeVideoInfo.cs;
2022-11-13 16:23:21 +02:00
Negulici-R. Barnabas 12ec0e285d Chapter Images:
- chapter image extraction intervals, limit count and resolutions can be set by the user from the server general settings;
2022-07-18 17:50:52 +03:00
Bond_009 dc222b75c5 Remove incorrect mime type image/jpg 2022-01-04 10:40:16 +01:00
Odd Stråbø afff226514 Apply suggestions from code review
Co-authored-by: Cody Robibero <cody@robibe.ro>
2021-04-11 08:21:23 +02:00
Odd Stråbø 13d0837b78 (mostly)Fix ResizeFill 2021-04-11 08:21:23 +02:00
Odd Stråbø 383aa4e4d9 Add Resize to fill box alternative to image endpoints 2021-04-11 08:20:47 +02:00
Bond_009 30ce346f34 Enable nullabe reference types for MediaBrowser.Model 2020-04-05 18:10:56 +02:00
Bond_009 07cc4be6a7 Fix some warnings
* Add analyzers to MediaBrowser.XbmcMetadata
* Enable TreatWarningsAsErrors for MediaBrowser.XbmcMetadata
* Add analyzers to MediaBrowser.WebDashboard
* Enable TreatWarningsAsErrors for MediaBrowser.WebDashboard
* Disable SA1600 in favor of CS1591
2020-02-23 12:11:43 +01:00
Bond-009 a2490a7ae5 Merge branch 'master' into images 2020-02-12 17:41:46 +01:00
Bond_009 f47ad85011 Fix warnings MediaBrowser.Model 2020-02-04 01:49:27 +01:00
Bond_009 ddf9b38799 Simplify image processing by removing image enhancers 2020-01-21 20:26:30 +01:00
Bond-009 e216702bcf Complete rename ImageSize -> ImageDimensions 2019-02-05 19:53:50 +01:00
Bond_009 883575893b Change image dimentions from double to int
Rename ImageSize -> ImageDimensions
2019-01-26 13:16:47 +01:00
Erwin de Haan 38f96af079 Reformat JustAMan review pt2 changes
Refs #575
2019-01-17 20:24:39 +01:00
Erwin de Haan e867446437 ReSharper format: conform inline 'out' parameters. 2019-01-13 21:46:33 +01:00
Erwin de Haan a36658f6f0 ReSharper Reformat: Properties to expression bodied form. 2019-01-13 21:31:14 +01:00
Erwin de Haan 8f41ba4d3a Find+Sed BOM removal *.cs: MediaBrowser.LocalMetadata-MediaBrowser.Model 2019-01-13 21:02:23 +01:00
Erwin de Haan 382e8699a2 EditorConfig reformat: MediaBrowser.Model 2019-01-13 20:31:15 +01:00
Andrew Rabert a86b71899e Add GPL modules 2018-12-27 18:27:57 -05:00
stefan 48facb797e Update to 3.5.2 and .net core 2.1 2018-09-12 19:26:21 +02:00
Luke Pulverenti e915ceda1b dummy up audio bitrates when needed 2017-05-10 22:57:48 -04:00
Luke Pulverenti 0f8ccfaf49 prep for portable common 2016-10-23 15:47:34 -04:00
Luke Pulverenti 4548e6598d support dvd without video_ts folder 2014-12-08 23:57:18 -05:00
Luke Pulverenti 999ad78a0d rework configurations 2014-11-29 14:51:30 -05:00
Luke Pulverenti 40897bac14 fixes #941 - Rework password recovery and remove IsLocal checks 2014-11-08 22:18:14 -05:00
Luke Pulverenti 7e636a977a fixes #903 - Display image info on web client detail page 2014-08-28 20:49:25 -04:00
Luke Pulverenti 93ded925a7 Fixes #901 - Improve captured photo metadata 2014-08-27 21:27:46 -04:00
Luke Pulverenti 20d35a6405 isolate .net specific methods in model project 2014-06-01 00:11:04 -04:00
Luke Pulverenti e653b41000 removed implicit typing from the model project 2014-05-08 16:44:17 -04:00
Luke Pulverenti bb031f553b fix portable and 3.5 project references 2014-05-08 16:26:20 -04:00
Luke Pulverenti f02c326027 Removed guids from the model project 2014-05-08 16:09:53 -04:00
Luke Pulverenti ec49a65752 correct dlna param positions 2014-03-28 00:24:11 -04:00
Luke Pulverenti 2fc662c9e9 optimize image processor when gdi can be skipped 2013-11-07 10:57:12 -05:00
Luke Pulverenti a2cd03610f Serve original image file when possible 2013-11-06 16:32:26 -05:00
Luke Pulverenti 7dae0069d6 added new image params & GameSystem constants 2013-10-02 11:32:11 -04:00
Luke Pulverenti 03d27d4756 add singular AddChildInternal 2013-09-21 11:06:21 -04:00
Luke Pulverenti b7a8b92c00 reduce system info refreshing from dashboard 2013-09-19 20:53:18 -04:00
Luke Pulverenti 088df67fca moved new image options to the model 2013-09-19 15:46:19 -04:00
LukePulverenti 767cdc1f6f Pushing missing changes 2013-02-20 20:33:05 -05:00