YOLOv7 error : " Image size exceeds limit of pixels, could be decom pression bomb DOS attack." - yolo

I recetly got an error of to big images:
Image size (223533999 pixels) exceeds limit of 178956970 pixels, could be decom
pression bomb DOS attack.
Do i have an option to extend this limit?

Related

Converting from canvas to PDF with default at 72 dpi causes incorrect page size

I am creating a canvas with predefined dimensions (2505px width, 3542px height) which are the dimensions for an A4 paper in 300 DPI resolution.
I am converting the canvas to pdf using createPDFStream (https://github.com/Automattic/node-canvas#canvascreatepdfstream). The outputted PDF is good but I notice that the Page Size is 34,79 x 49,19 inches (see image below), which is much larger than a regular A4 paper, which causes some problems further down the line.
I notice that this is because that createPDFStream is assuming that the PDF should be in 72dpi, since 2505px / 72dpi = 34,79 inches & 3542px / 72 dpi = 49,19 inches. My question is if there is a way to specify to createPDFStream that the PDF is supposed to be in 300dpi so that we get the correct Page Size. Alternatively, if there is a library to use to correct the Page Size or DPI settings without compromising the 300 DPI image quality.
I tried digging deeply through the node-canvas for a solution, but I could neither find a way to correct the DPI nor find the place where the 72 DPI assumption is set.

How does the pixel size change after the aspect ratio is chaged?

I am using NI PCI-1411 frame brabber card and the signal is RS-170 signal. According to the discussion on the website:https://www.cs.rochester.edu/~nelson/courses/vision/resources/video_signals.html.
It said"The aspect (width to height) ratio for typical RS-170 signal rectangle is 4:3. The vertical resolution of video is limited to 485 pixels, as determined by the number of scan lines. The RS-170 standard specifies the aspect ratio (ratio of vertical/horizontal dimensions) of the video display as 3:4"
The CCD I use is Hitachi KP-M1AN.Its number of pixels are 768(H)*494(V) and the pixels size is 11.64(um) * 13.5(um),sensing area is 8.91*6.67mm,Horizontal/Vertical TV resolution is 570/485
Here are my questions:
1.Now I gave a square object to CCD (The CCD is Hitachi KP-M1AN.CCD pixels size is 11.64(um)*13.5(um) and the ).According to the pixel size on CCD, the horizontal pixel numbers should be different with vertical pixel numbers.however, I notice the pixel numbers at both directions are same. So I wonder what is the "real" pixels size now after the ratio change ?
For example, here is a square object is 143um*143um and CCD pixel size is 11um*13um.And according to pixel size it must be 13 pixels * 11 pixels. But what I see now is 12 pixels * 12 pixels.
2.According to question 1, if the pixels size change owning to the ratio change.How does the NI software change the pixel size (I mean extend it or compress it.)

Can SoOffscreenRenderer use tiles bigger than 1024

The coin3d offscreen rendering class SoOffscreenRenderer is capable of rendering big images (e.g. 4000 x 2000 pixels), that don't fit on the screen or in a rendering buffer. This is done by partitioning the image into tiles that are rendered one after the other, where the default size of these tiles is 1024 x 1024.
I looked at the code of SoOffscreenRenderer and CoinOffscreenGLCanvas and found environment variables COIN_OFFSCREENRENDERER_TILEWIDTH COIN_OFFSCREENRENDERER_TILEHEIGHT. I could change the tile size using these variables, but only to sizes smaller than 1024. I could create tiles with 512 x 512 pixels, and also 768 x 768. When I used values bigger than 1024, the resulting tiles were always of size 1024 x 1024.
Is it possible to use bigger tile sizes like 2048 x 2048 or 4096 x 4096, and how would I do that?
It is possible to use larger tiles and coin does it automatically. It will find out which tile sizes work by querying the graphics card driver.
From CoinOffscreenGLCanvas.cpp:
// getMaxTileSize() returns the theoretical maximum gathered from
// various GL driver information. We're not guaranteed that we'll be
// able to allocate a buffer of this size -- e.g. due to memory
// constraints on the gfx card.
The reason why it did not work was that the environment variable COIN_OFFSCREENRENDERER_MAX_TILESIZE was set somewhere in our application using coin_setenv("COIN_OFFSCREENRENDERER_MAX_TILESIZE", "1024", 1);. Removing this call allowed bigger tile sizes to be used.
In CoinOffscreenGLCanvas::getMaxTileSize(void), the variable COIN_OFFSCREENRENDERER_MAX_TILESIZE is read and the tile size clamped accordingly.
On my older computer it generated tiles of size 1024, but on a newer machine the tiles were of size 4096.

How to get the default image of Wikipedia article?

Is it possible to get the (default) image associated with a Wikipedia article with an API call if only the URL of the article is known?
Is it possible to make constraints about the image size / resolution in the call (as an image is usually available in different resolutions)?
Is it possible to request the largest image version not larger than MAX_X px?
An example:
https://upload.wikimedia.org/wikipedia/commons/e/e9/Jaguar_%28Panthera_onca_palustris%29_female_Piquiri_River_2.JPG
is 4769x3179 large (1,5 ratio).
A request limiting the MAX_X size to 3000 would result in an image scaled to 3000x2000.
A request limiting the MAX_X size to 5000 would result in the image of the original size (4769x3179) because MAX_X is bigger than the image's x size.
Use MediaWiki API with pageimages. For example for Wikipedia article Jaguar and requested max image size 500 the query will be:
https://en.wikipedia.org/w/api.php?action=query&prop=pageimages&titles=Jaguar&pithumbsize=500
From the response you can get also the largest image version, just remove the thumb part and everything from the pixels to the end of the link.

Image Magick: Image optimization for websites

I have a camera which produces photographs of 3008x2000 pixels. I use Image Magick to scale and resize the photos to be put up on my website. The size of the images I am using on the website is 602x400. I use this command to reduce the size:
convert DSC_0124.JPG -scale 20% -size 24% img1.jpg
This produces an image which is 602x400 pixels in size. But the file size will be always above 250KB. More images on a single html page means the page will be heavier and loading time will be longer. Are there any features in image magic that will help me to keep the file size as small as possible, possibly, below 100KB. But the image size should be the same, that is, 602x400px. I have achieved similar optimisation with SEAMonster tool for MS Windows. As it doean't have a commandline alternative, it wouldn't be of much help when there are hundreds of images to be converted.
Use command as Delan proposed with additional "-strip" flag to remove EXIF data, this have reduced the size of some of my images drastically. Here is a bash script for unix platforms, but you can use the second part only for individual images.
for X in *.jpg; do convert "$X" -resize 602x400 -strip -quality 86 "$X"; done
This will convert all images in the directory.
Use -quality to set the compression level:
convert DSC_0124.JPG -scale 20% -size 24% -quality [0..100] img1.jpg
You can define the maximum size of the output image at 100KB like this:
convert DSC_0124.JPG -resize 602x400! -strip -define jpeg:extent=100KB img1.jpg
If you are running your website on PHP, you might want to consider the SLIR image resizing script, it does a great job resizing to various constraints (see below) and caches the results.
Parameters:
w Maximum width
h Maximum height
c Crop ratio
q Quality
b Background fill color
p Progressive
http://shiftingpixel.com/2008/03/03/smart-image-resizer/
http://code.google.com/p/smart-lencioni-image-resizer/