How to save image?

602 views
Skip to first unread message

Barney Gumble Channel

unread,
Mar 22, 2018, 3:29:12 AM3/22/18
to Kivy users support
Hello i need help for save images with kivy,Thank you

ZenCODE

unread,
Mar 22, 2018, 2:41:44 PM3/22/18
to Kivy users support

Barney Gumble Channel

unread,
Mar 23, 2018, 6:07:16 AM3/23/18
to Kivy users support
Thanks Zen but i have not understund this export png ,i post my code if u please can u show me how work please thank you very much Regards :)

import kivy
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.core.window import Window
from kivy.uix.image import Image


Builder.load_string("""
<Screen1>:
     AnchorLayout:

          AsyncImage:
               source: '1.jpg'
               size_hint_y: None  # Tells the layout to ignore the size_hint in y dir
               height: dp(2300)  # The fixed height you want
               allow_stretch: True
               keep_ratio: True
          Button:
               size_hint_y:None
               background_color: 0, 0, 0, .0
               pos_hint: {'center_x': .5, 'center_y': .5}
              
               font_size:30
               on_press:
                    root.manager.transition.direction = 'left'
                    root.manager.transition.duration = 1
                    root.manager.current = 'screen_2'

     BoxLayout:    
          Button:
               pos: 100, 100
               size_hint: .2, .1
               text: "AVANTI"
               on_press:             
                    root.manager.current = 'screen_2'
  
          Button:
               pos: 100, 100
               size_hint: .2, .1
               text: "ESCI"
               on_press: exit()  
 
<Screen2>:                    
     AnchorLayout:

          AsyncImage:
               source: '2.jpg'
               size_hint_y: None  # Tells the layout to ignore the size_hint in y dir
               height: dp(2300)  # The fixed height you want
               allow_stretch: True
               keep_ratio: True    
        
    
     BoxLayout:    
          Button:
               pos: 100, 100
               size_hint: .2, .1
               text: "PREVIOUS"
               on_press:             
                    root.manager.current = 'screen_1'





""")


class Screen1(Screen):
    pass

class Screen2(Screen):
    pass


screen_manager = ScreenManager()


screen_manager.add_widget(Screen1(name="screen_1"))
screen_manager.add_widget(Screen2(name="screen_2"))



class RicetteDelloChef(App):
 
    def build(self):
        return screen_manager


  

sample_app = RicetteDelloChef()
sample_app.run()


























ZenCODE

unread,
Mar 23, 2018, 1:35:32 PM3/23/18
to Kivy users support
All you need to do is is chose the widget whose image you want to capture, then call its "export_to_png('path/to/saved/file.png')" method.

Try it. Looks like you may want to use those methods on your screens.
Message has been deleted

Barney Gumble Channel

unread,
Mar 23, 2018, 1:49:32 PM3/23/18
to Kivy users support
Thanks Zen for your time and patience ,i must write a app for Google play i Need noob tutorial can u please write for me this method please :) regards if u cant dont worry thanks always

ZenCODE

unread,
Mar 23, 2018, 6:00:57 PM3/23/18
to Kivy users support
You need a tutorial to use a command? Perhaps explain what you mean by save images. What images? From where? And where do you want to save them? What are you trying to do?

Barney Gumble Channel

unread,
Mar 23, 2018, 11:29:14 PM3/23/18
to Kivy users support
I wanna create a app for Google play for Save Image (PNG) for create a background,im a beginner and i wanna create this app i mean u click Button Save and u Save the Image in your mobile phone and u can use it how Image background Sorry my english i Wish to bè clear best regards

ZenCODE

unread,
Mar 24, 2018, 3:30:10 PM3/24/18
to Kivy users support
What image? Where will it come from? Any image you create or display in kivy can be saved to a file via the export_to_png method mentioned above.

Barney Gumble Channel

unread,
Mar 24, 2018, 4:04:55 PM3/24/18
to kivy-...@googlegroups.com
Hello zen image of landscape,are Creative Commons image.I have not understund this method can help me undesrtund please? this is a part of my code https://dpaste.de/CP57 can complete this code for me?i wanna create simple application for google play thank you very much regards
Reply all
Reply to author
Forward
0 new messages