Skip to content

Commit a920f14

Browse files
authored
docs: add resizeMultiplier to Image props (facebook#4206)
* Add resizeMultiplier to Image props * Add example to resizeMultiplier section
1 parent 30d68cc commit a920f14

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

docs/image.md

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,16 @@ When `true`, enables progressive jpeg streaming - https://frescolib.org/docs/pro
314314

315315
---
316316

317+
### `referrerPolicy`
318+
319+
A string indicating which referrer to use when fetching the resource. Sets the value for `Referrer-Policy` header in the image request. Works similar to `referrerpolicy` attribute in HTML.
320+
321+
| Type | Default |
322+
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
323+
| enum(`'no-referrer'`, `'no-referrer-when-downgrade'`, `'origin'`, `'origin-when-cross-origin'`, `'same-origin'`, `'strict-origin'`, `'strict-origin-when-cross-origin'`, `'unsafe-url'`) | `'strict-origin-when-cross-origin'` |
324+
325+
---
326+
317327
### `resizeMethod` <div class="label android">Android</div>
318328

319329
The mechanism that should be used to resize the image when the image's dimensions differ from the image view's dimensions. Defaults to `auto`.
@@ -332,16 +342,6 @@ More details about `resize` and `scale` can be found at https://frescolib.org/do
332342

333343
---
334344

335-
### `referrerPolicy`
336-
337-
A string indicating which referrer to use when fetching the resource. Sets the value for `Referrer-Policy` header in the image request. Works similar to `referrerpolicy` attribute in HTML.
338-
339-
| Type | Default |
340-
| ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------- |
341-
| enum(`'no-referrer'`, `'no-referrer-when-downgrade'`, `'origin'`, `'origin-when-cross-origin'`, `'same-origin'`, `'strict-origin'`, `'strict-origin-when-cross-origin'`, `'unsafe-url'`) | `'strict-origin-when-cross-origin'` |
342-
343-
---
344-
345345
### `resizeMode`
346346

347347
Determines how to resize the image when the frame doesn't match the raw image dimensions. Defaults to `cover`.
@@ -365,6 +365,20 @@ Determines how to resize the image when the frame doesn't match the raw image di
365365

366366
---
367367

368+
### `resizeMultiplier` <div class="label android">Android</div>
369+
370+
When the `resizeMethod` is set to `resize`, the destination dimensions are multiplied by this value. The `scale` method is used to perform the remainder of the resize. A default of `1.0` means the bitmap size is designed to fit the destination dimensions. A multiplier greater than `1.0` will set the resize options larger than that of the destination dimensions, and the resulting bitmap will be scaled down from the hardware size. Defaults to `1.0`.
371+
372+
This prop is most useful in cases where the destination dimensions are quite small and the source image is significantly larger. The `resize` resize method performs downsampling and significant image quality is lost between the source and destination image sizes, often resulting in a blurry image. By using a multiplier, the decoded image is slightly larger than the target size but smaller than the source image (if the source image is large enough). This allows aliasing artifacts to produce faux quality through scaling operations on the multiplied image.
373+
374+
If you have a source image with dimensions 200x200 and destination dimensions of 24x24, a resizeMultiplier of `2.0` will tell Fresco to downsample the image to 48x48. Fresco picks the closest power of 2 (so, 50x50) and decodes the image into a bitmap of that size. Without the multiplier, the closest power of 2 would be 25x25. The resultant image is scaled down by the system.
375+
376+
| Type | Default |
377+
| ------ | ------- |
378+
| number | `1.0` |
379+
380+
---
381+
368382
### `source`
369383

370384
The image source (either a remote URL or a local file resource).

0 commit comments

Comments
 (0)