Good day,
Is there a way I could convert JPEG2000 base64 data to PNG data in Angular so I could display it on the browser? Here’s a test component to give you an idea of what I need:
my-component.component.ts
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'dha-my-component',
templateUrl: './my-component.component.html',
styleUrls: ['./my-component.component.scss']
})
export class MyComponentComponent implements OnInit {
imageData: string;
constructor() {}
ngOnInit(): void {
const testJ2KImage = '/0//UQA...';
this.imageData = this.convertJ2kToPng(testJ2KImage);
}
convertJ2kToPng(base64Data: string) {
// Convert base 64 data from JPEG2000 to PNG
const newPngImageData = 'iVBOR...';
return newPngImageData;
}
}
my-component.component.html
<img [src]="'data:image/png;base64,' + imageData" class="img img-responsive" />