IMAGE
when I click file>>save as png...
It will save as png to that penguin. Is it possible?
It is possible but the image must be a tkinter PhotoImage.
The picture of your program suggests that it's not a photoimage. However; google "tkinter PhotoImage" and you will find information on how to build one pixel by pixel or however you want. Once you have a photoimage, saving it is easy:
image.write('some_name.png', format='png')
Related
I'm making a pixel editor / a trash version of ms paint in python with pygame, and I want to save the window (canvas?) as a png or jpg. I've seen pygame.image.save, but that only saves a certain surface as an image, I want to save the entire window.
Give the following a try:
pygame.image.save(window, "screenshot.png")
Use pygame.image.save(), which requires PyGame 1.8 or later. If you give it the base-level window surface, it will indeed save the entire window content.
For example:
pygame.image.save( window, 'surface.png' )
The image type is determined by the filename suffix.
I am trying to capture a part of my screen with PIL.ImageGrab and then converting it to an numpy.array as you can see below.
np.array(ImageGrab.grab(bbox=(0, 0, 720, 480)))
What I can't figure out is, how to get this data into a Kivy window or a widget?
All my Widgets are in separate classes so I would like to have one Screen class with all the code necessary for this part of my Window.
I have already tried methods like this one, but I don't know how to implement it since Kivy confuses me a lot sometimes.
If my idea just isn't realizable, I guess you could save each captured frame as .jpg format and then load it into Kivy. But I imagine this is not the most efficient way.
Thanks a lot in advance! Dominik
First, I know this is a terrible workflow; it's being enforced on me by my employer's SDL Tridion Docs content management system, which seems to specialize in showing complete contempt for its users.
I need to open a raster image in Gimp, paste in a new image, resize the canvas, save and close. This works fine when the pasted-in image is smaller than the original image, but when the pasted-in image is larger I cannot for the life of me find a function to detect the size of the pasted-in image and expand the canvas to fit; all of the functionality seems to assume that the new image will be smaller. I'm looking for the equivalent of the "resize document to selection" command found in Inkscape.
If you do this manually, see Image>Fit canvas to layers.
If you do it in a script, pdb.gimp_image_resize_to_layers(image) in python, something similar in Script-fu.
Recently, I am working on process dicom imagećI don't know how to change the WWWL of a dicom image. Also, I use dcmtk to convert dicom image to bmp and show it(I didn't use vtk to show the image). I really don't know if that is correct.
I want to know the algorithm which can help me change the dicom image's window width and window level automatically. I didn't find the corresponding algorithm while I was using dcmtk.
thanks and regards.
If you want to specify the values of Window Center and Width (aka VOI transformation or windowing) manually, you can use DicomImage::setWindow() for this purpose. If you want to specify an automatically computed min-max window, you could use DicomImage::setMinMaxWindow().
i created gui application in vc++2010 express, i loaded image folder to list box and by selecting listbox item the image is displaying in picturebox1, using browse button.
Now i want to access the picturebox1 image and convert to gray scale image and converted grey scale must be displayed in picturebox2, using grey convert button. plzz help me frnds
thanq
karuna
Get the image in opencv Mat. Then use cvtColor function to convert the image. CV_BGR2GRAY code is used to convert from RGB to grayscale. Then show the grayscale image back to wherever you want to display it.