ImgProcProcessorOptions
このコンテンツはまだ日本語訳がありません。
Defined in: types.ts:248
Component options
- Part of props
Properties
Section titled “Properties”
optionalalt:string
Defined in: types.ts:257
artDirectives?
Section titled “artDirectives?”
optionalartDirectives:ImgProcArtDirectiveSourceProps[]
Defined in: types.ts:433
Array of art directive objects
asBackground?
Section titled “asBackground?”
optionalasBackground:boolean
Defined in: types.ts:393
Enforce background mode
- Only for
<Image>and<Picture>components.
Default
Section titled “Default”falsebackgroundPosition?
Section titled “backgroundPosition?”
optionalbackgroundPosition:null|string
Defined in: types.ts:380
Set CSS property background-position to the container element or the blurred image
- For
<Background>component, apply to the container element. - If
<Image>or<Picture>component and theplaceholderisblurred, apply to the<picture>and<img>elements.
MDN Reference: background-position
Default
Section titled “Default”"50% 50%"backgroundSize?
Section titled “backgroundSize?”
optionalbackgroundSize:null|string
Defined in: types.ts:372
Set CSS property background-size to the container element or the blurred image
- For
<Background>component, apply to the container element. - If
<Image>or<Picture>component and theplaceholderisblurred, apply to the<picture>and<img>elements.
MDN Reference: background-size
Default
Section titled “Default”"cover"blurProcessor
Section titled “blurProcessor”blurProcessor:
Sharp
Defined in: types.ts:321
Sharp instance to generate blurred images
- Note that blurred images are written to the inline CSS (and cache database) as Base64.
- Must include output option. (
.webp().avif()etc.)
Defult
Section titled “Defult”sharp().resize(20).webp({ quality: 1 })
containerAttributes?
Section titled “containerAttributes?”
optionalcontainerAttributes:Record<string,unknown> |HTMLAttributes<"div"> |HTMLAttributes<"a">
Defined in: types.ts:441
Attributes for container element
crossOrigin?
Section titled “crossOrigin?”
optionalcrossOrigin:null|""|"anonymous"|"use-credentials"
Defined in: types.ts:459
Cross origin for preload
densities?
Section titled “densities?”
optionaldensities:number[]
Defined in: types.ts:273
x descriptors to be used in srcset
- Convert to
0.5x2x
Example
Section titled “Example”[0.5, 1, 2, 3]enforceAspectRatio?
Section titled “enforceAspectRatio?”
optionalenforceAspectRatio:boolean
Defined in: types.ts:387
Set CSS property aspect-ratio to the container element based on width and height
- Only for
<Background>component and background mode. - If
widthand/orheightare not set as properties, the values resolved within the component are used.
format
Section titled “format”format: keyof
ImgProcFormatOptions
Defined in: types.ts:417
Output format
Default
Section titled “Default”"webp"formatOptions
Section titled “formatOptions”formatOptions:
ImgProcFormatOptions
Defined in: types.ts:429
Format options
jpegpngavifwebpandgifare allowed.
formats
Section titled “formats”formats: [keyof
ImgProcFormatOptions,...(keyof ImgProcFormatOptions)[]]
Defined in: types.ts:423
Output formats
- Last element is used as fallbak format.
Default
Section titled “Default”["avif", "webp"]height?
Section titled “height?”
optionalheight:number|`${number}`
Defined in: types.ts:267
Image height
layout?
Section titled “layout?”
optionallayout:null|"constrained"|"fixed"|"fullWidth"|"fill"
Defined in: types.ts:345
Specify the layout of the image
- Apply by adding the global class
globalClassNames.layout[layout]to the<picture>and<img>elements. - If set to
constrainedorfixed, the CSS propertywidthof the<img>element is set to the resolved value as scoped style. - The
<GlobalStyles>component sets the styles as follows:constrained:max-width: 100%; height: auto;fixed: N/AfullWidth:width: 100%; height: auto;fill:width: 100%; height: 100%;
- Styles can also be defined manually instead of
<GlobalStyles>using the generated classes.
Default
Section titled “Default”"constrained"maxAge?
Section titled “maxAge?”
optionalmaxAge:number
Defined in: types.ts:455
Maximum value of cache expiration period for remote files (milliseconds)
- Overrides HTTP header specification.
media?
Section titled “media?”
optionalmedia:string
Defined in: types.ts:290
minAge?
Section titled “minAge?”
optionalminAge:number
Defined in: types.ts:450
Minimum value of cache expiration period for remote files (milliseconds)
- Overrides HTTP header specification.
Default
Section titled “Default”1000 * 60 * 60 * 24 (1day)objectFit?
Section titled “objectFit?”
optionalobjectFit:null|"none"|"fill"|"contain"|"cover"|"scale-down"
Defined in: types.ts:355
Set CSS property object-fit to the <img> element
- Apply by adding the global class
globalClassNames.objectFit[objectFit]to the<img>element. - The
object-fitis set to this value by the<GlobalStyles>component. - Styles can also be defined manually instead of
<GlobalStyles>using the generated classes. - If a default value is required, specify it in the global style.
Default
Section titled “Default”nullobjectPosition?
Section titled “objectPosition?”
optionalobjectPosition:null|string
Defined in: types.ts:364
Set CSS property object-position to the <img> element
- If
placeholderisblurredandbackgroundPositionisnull, the value uses forbackground-positionproperty for blurred image.- If both
objectPositionandbackgroundPositionarenull, then50% 50%is used.
- If both
- If a default value is required, specify it in the global style.
MDN Reference: object-position
Default
Section titled “Default”nullpictureAttributes?
Section titled “pictureAttributes?”
optionalpictureAttributes:HTMLAttributes<"picture">
Defined in: types.ts:437
Attributes for <picture> element
placeholder
Section titled “placeholder”placeholder:
null|"blurred"|"dominantColor"
Defined in: types.ts:305
Placeholder
dominantColor: Usesharp().stats().dominantor the value ofdominantColoroption- Use for
background-colorin BackgroundImage component.
- Use for
blurred: Use blurred image generated byblurProcessor- Unavailable for BackgroundImage component.
null: Disable placeholder
Default
Section titled “Default”"blurred"placeholderColor?
Section titled “placeholderColor?”
optionalplaceholderColor:string
Defined in: types.ts:314
Background color
- If set, use for placeholder instead of dominant color.
- Only works with
placeholderoption isdominantColor. - Written to the CSS directly.
- Can also use
var(--foo).
preload?
Section titled “preload?”
optionalpreload: keyof ImgProcFormatOptions
Defined in: types.ts:398
Output <link rel="preload" ... >
- Only one format can be selected.
processor?
Section titled “processor?”
optionalprocessor:Sharp|Sharp[]
Defined in: types.ts:405
Sharp instance to process the image
- Do not use output options except the options about Exif/ICC Profile/Metadata.
Example
Section titled “Example”sharp().grayscale().blur()profile?
Section titled “profile?”
optionalprofile:string
Defined in: types.ts:412
Identifier of image processing profile for caching
- Not necessary for usual.
- If not set, hash of
sharp().optionswill be used to identify the processing profile. - If set, this value is used instead of the hash. This is faster than calculating the hash each time.
sizes?
Section titled “sizes?”
optionalsizes:string| (resolvedWidths,resolvedDensities) =>string
Defined in: types.ts:284
Default
Section titled “Default”(min-width: ${widths.at(-1)}px) ${widths.at(-1)}px, 100vw
optionalsrc:string
Defined in: types.ts:253
Source
- Local path, remote URL or data URL
tagName
Section titled “tagName”tagName: keyof
DefinedIntrinsicElements
Defined in: types.ts:295
Container element tagName
Default
Section titled “Default”"div"upscale
Section titled “upscale”upscale:
"never"|"always"|"original"
Defined in: types.ts:331
How to handle the value of widths/densities that are larger than the image.
always: Upscale the image to address all values.never: Ignore values larger than the original image size.- If image real width is
2500, width prop is1000and densities prop is[1, 2, 3], densities set to[1, 2].
- If image real width is
original: Add the original image size as the largest value.- If image real width is
2500, width prop is1000and densities prop is[1, 2, 3], densities set to[1, 2, 2.5].
- If image real width is
Default
Section titled “Default”"never"width?
Section titled “width?”
optionalwidth:number|`${number}`
Defined in: types.ts:263
Image width
- If
densitiesoption is used, this value is used as the value of1x. - If not set and
densitiesoption is used, the source image is used as the maximum density.
widths?
Section titled “widths?”
optionalwidths:number[]
Defined in: types.ts:279
w descriptors to be used in srcset
- Convert to
1000w2000w
Example
Section titled “Example”[1000, 1500, 2000]