Is it possible to resize base64 code representing the image? - power-automate

I am using power autoamte to convert an image in base64, and then I put this code in html.
Here is what I do:
I convert the original image to base64
I put this code in the html content in the <img src='myBase64'>
tag.
I convert the html to pdf format
Everything is fine, but when my html file reaches more than 2 mb my flow stops working. This is the limit for this conversion operation.
My question is:
Is it possible to resize the base64 code? I know there are external connectors resize images like Encodian, but I don't want to use them.
I searched on the internet, but without much results.
Thank you in advance

Related

VBA to read image directly from word document for Base64 Conversion

Basically I have a document with lots of small images and I need a fast way to build a list of unique images (and identify them in the document), I was thinking of using Base64 conversion to store each unique image in an xml file (or simply store the MD5 hash of each image).
If the images were saved as files somewhere (i.e outside of the document) I'd be able to do this but (unless there's good reason not to) I'd like to learn how to read the image directly from the document.
Specifically, if I have myDoc.InlineShapes(myImageIndex) how can I most efficiently PREPARE that to either convert to Base64 or create a hash?
All the examples I can find assume the image is loaded from file, I'm hoping to load the image directly from the document... (e.g. Convert image (jpg) to base64 in Excel VBA?)
Many thanks in advance,

Base64 img not showing after Winnovative PDFConverter HTML to PDF

I’ve been using the PDFConverter for years with no issues. And there are still no issues converting a large HTML form to PDF, except certain images aren’t showing.
I programmatically fill an HTML img element with a base64 string, like so:
imgSignature.Src = "data:image/jpg;base64," + Convert.ToBase64String(SignatureImage);
where SignatureImage is a byte[] array.
I've observed that if the byte[] array size is more than around 7K (not sure exactly the threshold), the image will not render to PDF (at least it’s not visible anyway). Anything under that displays fine. Note: the image displays in HTML just fine. It's when converting to PDF that it disappears if the byte array is too large
I've tried adjust the size of the img, the container it's in, everything I can think of.
Currently still going through Winnovative support docs but no luck so far.
Thanks for any advice.
Just in my case, I changed all images formats from jpeg to png, and it works for me. It's worth mentioning that my images are between 6kb to 8 kb (the images are Bar Codes)

base64 Image Cached?

I have an image encoded in base64 and in an HTML page.
Example:
<img src="data:image/jpeg;base64,/9j/4S/+...">
Simple question:
Is the above code cached or is it loaded every time the page loads? I find conflicting answers when I research the topic.
By "the above code cached" you mean if the image is decoded each time or if the browser keeps a decoded image cache in memory? If so, to me the answer is no, it won't keep the decoded image, only the data to decode the image again (the whole HTML in this case). Maybe I'm wrong, but that's what I will expect.

Data Types and file structure

I interested to work with data types and file formats.
For example I want to open a jpeg file with php and work with it.
For example get the size, or change it to black and white without any library.
I want to know that how can decode bytes of a file and get information about it?
I opened a jpeg file with HxD and saw some data in hexadecimal.
Please give me a reference to know more about files and structures...
Sorry for bad English.
Thanks a lot ...
A lot of image files are encoded using the Exchangeable Image File Format
In PHP you could use something like this method:
http://php.net/manual/en/function.exif-read-data.php
That will allow you to have access to the different properties of an image which are stored in the image header, such as resolution, endianess, etc. which you can then use to read in the raw image data.
The raw image data is usually stored immediately after the image header.
Here is the spec for the Jpeg File Interchange Format (JFIF):
http://www.jpeg.org/public/jfif.pdf
Also, in PHP if you're just reading raw image data you would use:
$file = 'picture.jpg';
readFile($file);
and you can then display it in a browser using:
header('Content-type: image/jpeg');

tcpdf: poor image quality

I am using TCPDF to create PDF files converted from HTML input using it's writeHTML() function. However, images within the PDF have poor quality, while the original images have a high quality (as expected). The images are in PNG format. I already tried to use SetJPEGQuality(100), but that had no effect.
What is causing this?
Try using this:
$pdf->setImageScale(1.53);
http://sourceforge.net/projects/tcpdf/forums/forum/435311/topic/4831671
When using HTML to generate your PDFs you need to manually calculate the images dimensions by dividing it's original width and height by 1.53 and set the result as attributes.
For example, an image with dimensions of 200x100 pixels will become:
<img src="image.jpg" width="131" height="65" />
This is a nasty workaround and doesn't completely remove the blur, but the result is much better than without any scaling.
Try To convert your Image to JPG or JPEG first. Until Now, I DOnt have a problem to convert image with TCPDF. I Think TCPDF is powerfull, because it can convert arabic language too. I HAve try convert arabic font with fpdf n it still fail
Little Up.
I'd same quality problem and I solved it...
When you save your picture, do it in 8bits instead of 24bits and you will see a "beautiful anti-aliasing".

Resources