I created a QRCODE size is 80 why logo inside QRcode and QRcode is blurry
how do I fix it?
I want to QRcode and img in the logo isn't blurry.
this is my code.
QrCode::format('png')->merge(public_path('img/test.jpg'), 0.5, true)
->size(80)
->errorCorrection('H')
->backgroundColor(0, 0, 0)
->color(231,195,111)
->generate('test'));
this is the solution.
Related
I get an image from the backend which I want to put in a puzzle shuffle game, however right now it is cropping from left to almost middle of the image , I would like to crop the center of the image, I was trying to use another Sprite which I cropped to the middle then use it in the ImageSlicer however I am getting same results.
Here are the images :
Main Image , Cropped Image as temp , Sliced Image as imagesSlices
am I doing the right thing and maybe I'm messing something in the code or this isn't how I should crop and slice ?
Sprite temp = Sprite.Create(currentImage, new Rect(currentImage.width * 0.25f, 0, currentImage.width * 0.75f, currentImage.height),new Vector2(0.5f, 0.5f), 100.0f);
Texture2D[,] imageSlices = ImageSlicer.GetSlices(temp.texture, blocksPerLine);
So the texture was staying the same and I was trying to get a new sprite not a new texture but I need a new cropped texture to work with which is why the sliced images were taken from old texture.
I am using a GridView to create a gallery of images that I display from a certain folder on my machine. The images are of different width*height ratios. Few are portrait images where the height of the image is like 3 times more than width. Some image are landscape like where the width is approx 3 times of height. And some images are squared.
The issue with my gallery is I have a square for each Image component of my GridView as you can see below. This makes the portrait & landscape images get incorrectly stretched as each block in the Grid is a square. Thus causing the aspect ratio of the image to get skewed up.
The Question:
How can I ensure that I display both portrait & landscape images into my square without skewing the aspect ratio? I am looking at putting some black/grey background on parts of the square which go blank on a portrait or landscape image? But there might be other tricks.
The code:
import QtQuick 2.5
import Qt.labs.folderlistmodel 2.1
import QtQuick.Controls 1.1
import QtQml.Models 2.1
GridView {
cellHeight: height/2
cellWidth: width/2
clip: true
FolderListModel {
id: dir_model
folder: "/path/to/images/folder"
nameFilters: ["*.png"]
}
Component {
id: file_delegate
Image {
width: (parent.width)/2
height: (parent.width)/2
source: fileURL
}
}
model: dir_model
delegate: file_delegate
}
Just set Image fillMode property to Image.PreserveAspectFit
As the doc says:
the image is scaled uniformly to fit without cropping
I am trying to add an image as a background of a button in pygame gui. I have the button created now and I just need to add the image. How can I add the image to the button?
This is my code
game1 = pygame.Rect(150 , 100, 200, 150) # creates a rect object
pygame.draw.rect(screen, [255, 100, 0], game1) # draw objects down here
it works fine
You're probably looking for pygame.Surface.blit (http://www.pygame.org/docs/ref/surface.html#pygame.Surface.blit)
Load your background image and blit it wherever you want.
img = pygame.image.load('thisisanimage.png')
WhateverYourDisplayNameIs.blit(img,(x,y))
Just in case you're confused, it looks like you're using screen as your display surface.
I'm having trouble creating a template image for the OSX menu bar. As far as I can tell, it has to be a PDF image. To that end, I have:
var pageRect: CGRect = CGRectMake(0, 0, CGFloat(10), CGFloat(barHeight))
let pdfData: NSMutableData = CFDataCreateMutable(nil, 0)
let pdfConsumer = CGDataConsumerCreateWithCFData(pdfData as CFMutableDataRef)
let pdfContext = CGPDFContextCreate(pdfConsumer, &pageRect, nil)
Then I draw into the PDF:
CGPDFContextBeginPage(pdfContext, nil)
CGContextSetRGBFillColor (pdfContext, 1, 0, 0, 1)
CGContextFillRect (pdfContext, CGRectMake (0, 0, 200, 100 ))
CGPDFContextEndPage(pdfContext)
Then I try to create an NSImage:
let image = NSImage(data: pdfData)
And add it to the status item's image property:
button.image = image
However, this just isn't working. I have tried saving the image to disk and opening it, but get the message that the image is corrupted, so I suspect the error is in converting the pdfData into an NSImage, though I'm not totally confident of that. Anyway, any help would be appreciated.
A template image does not have to be a PDF. To make an instance of NSImage a template image, simply set its template property to true.
No matter the nature of the image (bitmap, PDF, whatever), the system will only make use of its alpha channel when it's a template image. The color channels are ignored.
The system will automatically mark an image loaded from a file as a template image if its filename-minus-extension ends with "Template". So, for example, fooTemplate.png or barTemplate.pdf.
i have an image and i want to crop it i applied this code but its only cropping the image but not showing the cropped image on the axes :
imrect(Iedge2)
hPlot = plot(xBox, yBox);
pause(2)
delete(hPlot)
cla('reset')
imshow(I, []); % No need to specify 'Parent' now.
title('Cropped Image', 'FontSize', 12);
i want to show the message on the top of the axes area that "crop the image" when the crop process occurs and after selection of the area the cropped area will be shown to the `axes2 .some body please tell me is there is any function or method to do so?
thanks and regards`