Skip to content

Commit

Permalink
feat(server): separate quality for thumbnail and preview images (#13006)
Browse files Browse the repository at this point in the history
* allow different thumbnail and preview quality, better config structure

* update web and api

* wording

* remove empty line?
  • Loading branch information
mertalev committed Sep 28, 2024
1 parent 4248594 commit 995f0fd
Show file tree
Hide file tree
Showing 17 changed files with 364 additions and 193 deletions.
1 change: 1 addition & 0 deletions mobile/openapi/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions mobile/openapi/lib/api.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions mobile/openapi/lib/api_client.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

118 changes: 118 additions & 0 deletions mobile/openapi/lib/model/system_config_generated_image_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 15 additions & 43 deletions mobile/openapi/lib/model/system_config_image_dto.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

48 changes: 27 additions & 21 deletions open-api/immich-openapi-specs.json
Original file line number Diff line number Diff line change
Expand Up @@ -11654,42 +11654,48 @@
],
"type": "object"
},
"SystemConfigImageDto": {
"SystemConfigGeneratedImageDto": {
"properties": {
"colorspace": {
"$ref": "#/components/schemas/Colorspace"
},
"extractEmbedded": {
"type": "boolean"
},
"previewFormat": {
"format": {
"$ref": "#/components/schemas/ImageFormat"
},
"previewSize": {
"minimum": 1,
"type": "integer"
},
"quality": {
"maximum": 100,
"minimum": 1,
"type": "integer"
},
"thumbnailFormat": {
"$ref": "#/components/schemas/ImageFormat"
},
"thumbnailSize": {
"size": {
"minimum": 1,
"type": "integer"
}
},
"required": [
"format",
"quality",
"size"
],
"type": "object"
},
"SystemConfigImageDto": {
"properties": {
"colorspace": {
"$ref": "#/components/schemas/Colorspace"
},
"extractEmbedded": {
"type": "boolean"
},
"preview": {
"$ref": "#/components/schemas/SystemConfigGeneratedImageDto"
},
"thumbnail": {
"$ref": "#/components/schemas/SystemConfigGeneratedImageDto"
}
},
"required": [
"colorspace",
"extractEmbedded",
"previewFormat",
"previewSize",
"quality",
"thumbnailFormat",
"thumbnailSize"
"preview",
"thumbnail"
],
"type": "object"
},
Expand Down
12 changes: 7 additions & 5 deletions open-api/typescript-sdk/src/fetch-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1100,14 +1100,16 @@ export type SystemConfigFFmpegDto = {
transcode: TranscodePolicy;
twoPass: boolean;
};
export type SystemConfigGeneratedImageDto = {
format: ImageFormat;
quality: number;
size: number;
};
export type SystemConfigImageDto = {
colorspace: Colorspace;
extractEmbedded: boolean;
previewFormat: ImageFormat;
previewSize: number;
quality: number;
thumbnailFormat: ImageFormat;
thumbnailSize: number;
preview: SystemConfigGeneratedImageDto;
thumbnail: SystemConfigGeneratedImageDto;
};
export type JobSettingsDto = {
concurrency: number;
Expand Down
23 changes: 13 additions & 10 deletions server/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
VideoContainer,
} from 'src/enum';
import { ConcurrentQueueName, QueueName } from 'src/interfaces/job.interface';
import { ImageOutputConfig } from 'src/interfaces/media.interface';

export interface SystemConfig {
ffmpeg: {
Expand Down Expand Up @@ -109,11 +110,8 @@ export interface SystemConfig {
template: string;
};
image: {
thumbnailFormat: ImageFormat;
thumbnailSize: number;
previewFormat: ImageFormat;
previewSize: number;
quality: number;
thumbnail: ImageOutputConfig;
preview: ImageOutputConfig;
colorspace: Colorspace;
extractEmbedded: boolean;
};
Expand Down Expand Up @@ -259,11 +257,16 @@ export const defaults = Object.freeze<SystemConfig>({
template: '{{y}}/{{y}}-{{MM}}-{{dd}}/{{filename}}',
},
image: {
thumbnailFormat: ImageFormat.WEBP,
thumbnailSize: 250,
previewFormat: ImageFormat.JPEG,
previewSize: 1440,
quality: 80,
thumbnail: {
format: ImageFormat.WEBP,
size: 250,
quality: 80,
},
preview: {
format: ImageFormat.JPEG,
size: 1440,
quality: 80,
},
colorspace: Colorspace.P3,
extractEmbedded: false,
},
Expand Down
Loading

0 comments on commit 995f0fd

Please sign in to comment.