
Security News
Meet Socket at Black Hat Europe and BSides London 2025
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.
@ibm-wch-sdk/ng-rendition
Advanced tools
Support package for @ibm-wch-sdk/ng to work with images and renditions.
Module that allows to attach rendition support to a WCH based Angular application.
Install the module via
npm install --save ibm-wch-sdk-ng-rendition
Add the module to your root application
@NgModule({
...
imports: [
...
WchNgRenditionModule.forRoot()
],
...
})
export class AppModule { }
The module exposes the WchRenditionService and the wchRendition directive.
WCH offers the concept of Renditions when working with managed image assets. Each managed image asset has the original image plus zero or more variations of that image. Each variation is a (scaled) detail of the original image, called a Rendition. The purpose is to allow the business user to define the look of the image in different aspect ratios and sizes.
From a developer's perspective it is challenging to select the correct rendition in a given rendering scenario, because:
best match is a multi-dimensional optimization problem. In particular developers want to avoid to use renditions that produce larger images than required, to save bandwidth. On the other hand, using too small renditions causes pixelated, non-optimal image rendering.The ibm-wch-sdk-ng-rendition library solves this issue by calculating the optimum image transform dynamically based on measuring the real estate on the device, finding the best matching rendition and the scaling the rendition to give the best possible result. The selection algorithm is based upon the following assumptions:
Based on these assumptions the library computes the image as follows. It takes the target dimensions of the real estate of the image on the device as an input (which can either be computed by measuring the HTML elements or be provided by the application).
The result of this process is a new URL that targets the Akamai rendition service with the computed scaling and cropping. This guarantees that:
The rendition service exposes an API to compute rendition URLs. This service is the most generic way to work with renditions, it burdens the task to measure the target area to the caller
getRenditionUrl(w, h, img): string: computes the rendition URL for the given image (from the rendering context) such that it can be embedded into a target area of given width and heightThe directive can be attached to an image element within a WCH layout.
<img [wchRendition]="myImage" [relHeight]="0.3">
The rendition supports the following parameters:
[wchRendition]: points to the image element from the RenderingContext. Required.[relWidth], [relHeight]: floating point numbers between 0 and 1. The numbers specify the size of the image relative to the other dimension. You would e.g. typically specify only one of the directives, e.g. relHeight. This would set the height of the image relative to the available width (and vice versa). These properties therefore effectively set the aspect ratio.[imgWidth], [imgHeight]: numbers that specify the size of the real estate covered by the rendered image in pixels. If any of these numbers are missing, the real estate will be measured. Uses these numbers if you can measure the size more reliably than the automatic measurement.(onImage): event sent by the directive to communicate the actual dimensions and the URL of the rendered image.FAQs
Support package for @ibm-wch-sdk/ng to work with images and renditions.
We found that @ibm-wch-sdk/ng-rendition demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Socket is heading to London! Stop by our booth or schedule a meeting to see what we've been working on.

Security News
OWASP’s 2025 Top 10 introduces Software Supply Chain Failures as a new category, reflecting rising concern over dependency and build system risks.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.