HELLLPPPPP!!!!! I am programming in Corona SDK, and I am trying to insert a backround image, with the following code ---local backround = display.newImage("bluebackround.jpg")--- But it does not want to show up in the simulator. It keeps giving me the following message in the output, ---Failed to find image 'bluebackround.jpg'---. My image is saved in the project folder. I am using Microsoft Windows software. I have done another project using Corona, and I inserted images completely fine. Anyone know what's going on with my code and how to fix it? Thank you very much in advance.
_W = display.contentWidth;
_H = display.contentHeight;
local image = display.newImageRect(--[["Name", width, heigth]] "bluebackround.jpg",_W, _H)
image.x = _W/2;
image.y = _H/2;
The your image need to be in the same folder as main.lua in your case. On the same level. Moreover, I think you misspell name of your image. You write 'bluebackround' without letter g in middle. So check name of the file.
From Corona documentation
Image guildelines:
Corona supports PNG and JPG format,
Images should not contain an embedded ICC profile,
Avoid progressive JPG files since they will take much longer to load.
Related
I'm working with fastai, trying to pass some images to a dataloader. The original images are kind of pinkish, but after passing them they appear mostly as green-black (see image in link below):
Original pinkish image (up) and example images (down) after passing them to dataloader, and the code.
The code I've used for the datablock and to show the images is:
example = DataBlock(
blocks=(ImageBlock, CategoryBlock),
get_items=get_image_files,
splitter=GrandparentSplitter(),
get_y=parent_label,
item_tfms=Resize(128)) #already tried it without item_tfms just in case, still black-green
dls = example.dataloaders(path)
dls.show_batch(nrows=1, ncols=3)
I tried with .tif and .jpeg images, and both show the same problem. The only thing that comes to my mind is that somewhat somewhere is not reading correctly the color format (RGB according to my original files), or maybe transforming it; but I'm not able to figure it out.
Just in case it's important, I'm working in a Jupyter notebook with a MackBook Air M1.
Thanks!
Irene
Im trying to check if a screenshot contains an image that is saved in the project resources, I need to find a 100% match only and would like to not use any extra libraries, now with that being said, I have no idea how to do so.
heres a few questions:,
do I compare the two buffered images together? do I change them into something else?
Il have to compare it atleast once a second or so. (just as general information)
I have a resource folder under my project in eclipse and the .png files are shown as text, is there a way to change that? I tried tinkering with the settings, no luck yet.
public static BufferedImage screenshot(){
BufferedImage capture = robot.createScreenCapture(screenSize);
return capture;
}
this is my screenshot, another bufferedimage is for example "compare", where the size of the compared image is smaller than the screenshot. how will I be able to check if the image contain the second image?
*For those who wondering, im trying to make a simple program that clicks a certain image once it pops up.
General problem description
I have 33 TIFF16 images and I want to do some processing on them using MATLAB. So reading them is the first step. After I download an image from the web and then try to read it using MATLAB's imread (as well as Tiff and read). I display the image using imshow. The image displayed by the Windows File Viewer and MATLAB is totally different. I cannot process them since I don't trust MATLAB has read them correctly. I give more specifics of the problem now.
EDIT: If it helps, the details of the TIFF16 images are: TIFF (16 bits per channel, ProPhoto RGB color space, lossless compression)
More details:
I download an image a0008-WP_CRW_3959.tif. Destination: Go to this link -> img0008 -> Expert B (In case somebody wants to try, otherwise I have screenshots below).
I read that image in MATLAB using: img=imread('imgFilename.tif','tiff'); imshow(img,[]); or
t = Tiff('imgFilename.tif','r');
imageData = read(t);
imshow(imageData);
Now, I display the snapshots of Windows file viewer:
Next, snapshot of what MATLAB shows me:
Now, I have a good reason to believe that Windows file viewer is correct. Go the same link as previous. Scroll down to img0008. Hover your mouse onto the leftmost img0008. A thumbnail view of Expert B will come which looks same as what Windows shows me.
Does anybody know how to make MATLAB read and show the tiff16 image correctly?
Thank you #MarkRansom for pointing me to the embedded color profile possibility. I believe the following solution is correct and produces the same output as Windows File Viewer.
First read the icc-color-profile using iccread command.
I_rgb = imread('a0008-WP_CRW_3959.tif');
outprof = iccread('sRGB.icm');
P = iccread('a0008-WP_CRW_3959.tif');
Then convert the image into sRGB profile using makecform and applycform:
C = makecform('icc',P,outprof);
I_cmyk = applycform(I_rgb,C);
imwrite(I_cmyk,'pep_cmyk.tif','tif')
info = imfinfo('pep_cmyk.tif');
imshow('pep_cmyk.tif');
The original image saved on disk and the new - pep_cmyk.tif - look exactly the same with Windows file viewer.
Im having problem in my code in KITKAT OS. I want to get/display an image from gallery and decode it if its a higher size and its working fine for API lower than 19. But when I tried my app in KITKAT, I always get a null pointer exception because it returned.
content://com.android.providers.media.documents/document/image:62
I already look for solutions and found this.
input = context.getContentResolver().openInputStream(selectedImage);
bmp = BitmapFactory.decodeStream(input);
Its displaying the image but I'm missing one more step, that is to decode it since i cant get the exact file path of the image.
Bitmap imgbitmap = BitmapFactory.decodeFile(filepath, options_for_not_toobig);
How would I get the exact address of the image in KITKAT or how other way in decoding an image.
thanks
Try this code if Android version is kitkat:
ParcelFileDescriptor parcelFileDescriptor = getContentResolver().openFileDescriptor(uri, "r");
FileDescriptor fileDescriptor = parcelFileDescriptor.getFileDescriptor();
bitmap = BitmapFactory.decodeFileDescriptor(fileDescriptor);
parcelFileDescriptor.close();
Go through this link - https://developer.android.com/guide/topics/providers/document-provider.html
I've posted a answer in another post where similar issue is lifted. There youll find the method for getting the path in KitKat.
File Upload in WebView
The VS2010 image library contains several pngs of standard icons (Warning, Error, ...) in different sizes side by side. What is the use of such a png?
Is it meant as source to cut the best size and save it as new png?
Or is there a way to use such a png and the best resolution is picked automatically. And if so, how is this done?
I wonder why there are such side-by-side images and not several files such as Warning32.png, Warning16.png ....
Example: Information.png
It is an old programming trick and it is exactly what you assume it to be. The bitmap is a "film roll" and to make it work you have to know the pitch of the images, the resource doesn't tell you. Hard-coded in the source code. Microsoft's source code, you got the copy of their work.