how to resolve displaying images with inappropriate size for data:image/gif;base64 - materialize

I have noticed that lighthouse is saying the I am displays images with inappropriate size for data:image/gif;base64, this iamge is generated by Materialize slider and its giving a displayed size of 381x655 an actual size 1x1 and an expected size 1143 x 1965, I can see that lighouse explains how to resolve this issue with the original image but I can not find out how to resovle this issue for a data:image/gif;base64 generated image by Materialize I mean is it a setting in jquery or css or is there some other method ?

looking at your question I guess the solution is
<img srcset="image_1143x1965.jpg 2x, image_381x655.jpg 1x" src="image_default.jpg" />
an explanation of this can be found at https://html.com/attributes/img-srcset/

Related

How does TestCafé calculate the size of the element screenshot from a selector?

We're trying to debug an issue we're seeing between TestCafé and Chrome in that (for a base use case) we're seeing extra pixels added to the height of the element being used to make a snapshot. I'm going to assume that this is due to our element being taller than we think but in the Chrome debugger, the height of the element looks to be correct, whereas in the snapshot it's not.
I've looked over the TestCafé source a bit (from both directions: from the takeElementScreenshot method down and from the pngJS code up) but have been unable to pinpoint exactly where the size of the snapshot to take is extracted (calculated) from the selector passed into takeElementScreenshot.
Can someone please point me to the right place in the source code where this is happening? Thanks.
First, the data is taken from the element located in the upper left-hand corner of the document:
https://github.com/DevExpress/testcafe/blob/master/src/client/driver/command-executors/browser-manipulation/index.js#L50
Then, it is converted to values relative to the visible part of the document:
https://github.com/DevExpress/testcafe/blob/master/src/client/driver/command-executors/browser-manipulation/ensure-crop-options.js
There, the pixel coordinates for cutting are calculated:
https://github.com/DevExpress/testcafe/blob/master/src/screenshots/crop.js

cefpython3 (cefwx example2) iCCP: known incorrect sRGB profile

How do i fix or ignore this warning popup? The example works fine, but this warning popup keeps showing. I looked around for a solution and image magic seems to be the fix. However, there are no images causing this problem in the sample code. I'm assuming it is what is being loaded by the browser. Can someone help me solve this problem please?
I can confirm this issue with wx.version=3.0.2.0 msw (classic) and cefpython 31.2. The navigation bar in this example loads three buttons (back, forward, reload) from this directory: c:\Python27\Lib\site-packages\cefpython3\wx\images:
Arrow Left.png
Arrow Right.png
Button Load.png
These cause the "iCCP: known incorrect sRGB profile" error.
Solution: In the c:\Python27\Lib\site-packages\cefpython3\examples\wx\ directory there are three images (back.png, forward.png, reload_page.png). Replace the problematic images with these by renaming them (back.png to Arrow Left.png etc) and copying to the c:\Python27\Lib\site-packages\cefpython3\wx\images directory.
Created Issue #221 to fix this.
If using wx 2.9/3.x you might also encounter text input issue. The cefpython 31.2 release was tested with wx 2.8 only.

Optaplanner; Why the Memory use tag in the html page does not work?

Using the benchmark statistics I obtain the memory use tag in the html page but it does not give me any related graph, the part of my benchmark xml file is:
<problemBenchmarks>
<xStreamAnnotatedClass>org.optaplanner.examples.myproblem.domain.MySchedule</xStreamAnnotatedClass>
<inputSolutionFile>data/myproblem/unsolved/[26]Day(16.01.15-10.02.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[25]Day(16.01.15-9.02.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[20]Day(16.01.15-4.02.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[15]Day(16-30.01.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[10]Day(16-25.01.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[5]Day(16-20.01.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[2]Day(16,17.01.15).xml</inputSolutionFile>
<inputSolutionFile>data/myproblem/unsolved/[1]Day(16.01.15).xml</inputSolutionFile>
<problemStatisticType>BEST_SCORE</problemStatisticType>
<problemStatisticType>STEP_SCORE</problemStatisticType>
<problemStatisticType>CALCULATE_COUNT_PER_SECOND</problemStatisticType>
<problemStatisticType>BEST_SOLUTION_MUTATION</problemStatisticType>
<problemStatisticType>MOVE_COUNT_PER_STEP</problemStatisticType>
<problemStatisticType>MEMORY_USE</problemStatisticType>
<singleStatisticType>CONSTRAINT_MATCH_TOTAL_BEST_SCORE</singleStatisticType>
<singleStatisticType>CONSTRAINT_MATCH_TOTAL_STEP_SCORE</singleStatisticType>
<singleStatisticType>PICKED_MOVE_TYPE_BEST_SCORE_DIFF</singleStatisticType>
<singleStatisticType>PICKED_MOVE_TYPE_STEP_SCORE_DIFF</singleStatisticType>
</problemBenchmarks>
Where is my wrong action?
A screen shot for the Memory_Use:
A Screen shot for the Best_Score, note that when I clicked the memory use tab no change from using the best score tab:
The behaviour looks similar as described in this jira: a bug in the generated anchor id's. But I can't reproduce it in 6.4.0.SNAPSHOT, so I suspect it was fixed a long time ago (that jira can't have fixed it).
You should upgrade from 6.2 to at least 6.3.

PdfBox write Page to Image scales Signatures

when trying to create an Image from a signed PDF Page, the resulting image shows the signatures but the signatures are not displayed correctly.
For example, the original contains two signatures next to each other in the bottom section.
In the resulting image the signatures look like they have been scaled up and are overlapping.
Furthermore, there's a signature in the top right corner. This signature looks scaled up in the resulting image and is cut off to the right. What is happening here? What am I doing wrong? I'm pretty new to working with PDFs on this level.
Hope that makes sense. Please see below for the differences (I've cut out other content).
Here's the code I'm using:
List<PDPage> pages = inputDocument.getDocumentCatalog().getAllPages();
PDPage page = pages.get(0);
BufferedImage image = page.convertToImage(BufferedImage.TYPE_INT_RGB, PDF_RESOLUTION);
String fileName = "converted_image_" + (i + 1);
ImageIOUtil.writeImage(image, "png", fileName, BufferedImage.TYPE_INT_RGB, PDF_RESOLUTION);
here's the original
and now the distorted version
As suggested by Tilman Hausherr, I was using the current 1.8.x stable release which has problems with annotations appearances. This led to the seen behaviour. Testing with the current 2.0 SNAPSHOT solves this problem.
Now we are eagerly awaiting the release of 2.x :)
From what I've seen, they totally reworked how creating images from a PDF(Page) should be done so I'm not sure about the probability of a backport.
Hope that helps for anyone else coming across this.

When using pdfpages in LaTeX, how to avoid page breaks before the first page ?

I am creating a large LaTeX document, and my appendix has reproductions of several booklets that I have as PDFs. I am trying to create a section header and then include the pages at a slightly lower scale. For example:
\section{Booklet about Yada Yada Yada}
\includepdf[pages={-}, frame=true, scale=0.8]{booklet_yadayada.pdf}
However, pdfpagex does two annoying things. First, it devotes one output document page for included document page. I can live with that as I am using 80% scale. The main problem, however, is that the first page is also a new page, so I have a page with just a section title, and then a separate page with the booklet.
Is there some way to get pdfpages to be a little smarter here?
\includepdf uses \includegraphics internally, so something like
\section{Foo}
\fbox{\includegraphics[page=1,scale=0.8]{foo.pdf}}
would include the page without starting a new one, although it only does one page at a time.
For me the following worked just fine:
\includepdf[pages=1,pagecommand=\section{Section Heading}]{testpdf}
\includepdf[pages=2-,pagecommand={}]{testpdf}
I tried this solution too, but \includepdf keeps the advantage of outputting the file over the margin (the output is centered from the edges of the page).
So I openned pdfpages.sty, and I searched for \newpage command. I deleted the first occurance (line 326), just to try, and after saving then compiling again, there were no page break anymore.
Use the minipage environement :
\chapter*{Sujet du stage}
%\fbox{
\begin{minipage}{\textwidth}
\includepdf[scale=0.8]{../sujet-stage/main.pdf}
\end{minipage}
It doesn't add any extra page and it works with includepdf.
Thanks for all the answers - I couldn't for the life of me figure out what logic \includepdf uses to insert blank pages; the trick with including the first page via \includegraphics solved most (but not all) of those problems; so here are some notes:
First, out of curiosity, I have also tried to use only \includepdf, but split in two parts:
\includepdf[pages=1]{MYINCLDOC.pdf}
\includepdf[pages=2-last]{MYINCLDOC.pdf}
... unfortunately, this has the same problem as the question in OP.
Since #WASE's answer, there are now multiple \newpages in the source (pdfpages.sty). I tried reading the source, but I found it quite difficult; so I tried temporarily setting \newpage to \relax only for \includepdf - and that puts all pages in the document on top of each other; so probably not a good idea to get rid of \newpage blindly.
Just \includegraphics[page=1,scale=0.8]{foo.pdf} works - but (as #WASE also note) it is aligned at the top-left corner of the page body, which is to say inside the margins; for a full page we'd want the pdf inclusion overlaid over the whole page, margins included.
This page: graphics - How do I add an image in the upper, left-hand corner using TikZ and graphicx - TeX - LaTeX points to several possibilities for positioning on page over the margins; but for me, the best solution for a full page PDF inclusion is to use package tikz to center it to the page:
\begin{tikzpicture}[remember picture,overlay]
\node at (current page.center) {\includegraphics[page=1]{MYINCLDOC.pdf}};
\end{tikzpicture}
\includepdf[pages=2-last]{MYINCLDOC.pdf}
After this is done, as a bonus, I have also experienced:
Proper targets of PDF bookmarks (going to the right page when clicked)
If you use package pax, the data seems to be included also for the \includegraphics standalone first page, so no difference there
If you have a twoside document - pdfpages, with the above split of the first page in \includegraphics, will now (seemingly) correctly insert the equivalent of \cleardoublepages between pdfs that are included back to back (so I don't have to insert such a command manually).
Hope this helps someone,
Cheers!
I'm a little late, but the following solution worked for me:
\includepdf[pages={-},angle=90, scale=0.7]{lorem-ipsum.pdf}
All pages are imported, scaled and rotated by 90 degrees.
Works with Texmaker 5.0.4