save

Saving EXIF data to JPEG - Swift

丶灬走出姿态 提交于 2021-02-19 15:33:40
问题 I am currently trying to shoot photos within an app with the UIImagePickerController, saving it to the local database and upload them later to a service. But it seems that the metadata (especially EXIF) are not bundled with this image automatically. I've tried to extract it like this: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { self.imageDelegate?.saveImage( image: info[UIImagePickerControllerOriginalImage] as! UIImage,

Saving EXIF data to JPEG - Swift

三世轮回 提交于 2021-02-19 15:33:28
问题 I am currently trying to shoot photos within an app with the UIImagePickerController, saving it to the local database and upload them later to a service. But it seems that the metadata (especially EXIF) are not bundled with this image automatically. I've tried to extract it like this: func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { self.imageDelegate?.saveImage( image: info[UIImagePickerControllerOriginalImage] as! UIImage,

Python reportlab save with canvas to specified location

点点圈 提交于 2021-02-19 04:41:33
问题 I am wondering how I can make my script save to the Desktop. Here's my code: from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter from reportlab.platypus import Image import csv import os data_file = "hata.csv" def import_data(data_file): inv_data = csv.reader(open(data_file, "r")) for row in inv_data: var1 = row[0] # do more stuff pdf_file = os.path.abspath("~/Desktop/%s.pdf" % var1) generate_pdf(variable, pdf_file) def generate_pdf(variable, file_name): c = canvas

Python reportlab save with canvas to specified location

筅森魡賤 提交于 2021-02-19 04:41:07
问题 I am wondering how I can make my script save to the Desktop. Here's my code: from reportlab.pdfgen import canvas from reportlab.lib.pagesizes import letter from reportlab.platypus import Image import csv import os data_file = "hata.csv" def import_data(data_file): inv_data = csv.reader(open(data_file, "r")) for row in inv_data: var1 = row[0] # do more stuff pdf_file = os.path.abspath("~/Desktop/%s.pdf" % var1) generate_pdf(variable, pdf_file) def generate_pdf(variable, file_name): c = canvas

How can I save an object containing keras models?

情到浓时终转凉″ 提交于 2021-02-19 03:33:07
问题 Here is my code skeleton: def build_model(x, y): model = tf.keras.models.Sequential() model.add(tf.keras.layers.Dense(1, activation='relu')) model.compile(loss='mean_squared_error', optimizer='adam') model.fit(x, y) return model class MultiModel(object): def __init__(self, x1, y1, x2, y2): self.model1 = build_model(x1, y1) self.model2 = build_model(x2, y2) if __name__ == '__main__': # code that builds x1, x2, y1, y2 mm = MultiModel(x1, y1, x2, y2) # How to save mm ? The issue is I don't know

Write user input to file python

烈酒焚心 提交于 2021-02-17 07:02:23
问题 I can't figure out how to write the user input to an existing file. The file already contains a series of letters and is called corpus.txt . I want to take the user input and add it to the file , save and close the loop. This is the code I have : if user_input == "q": def write_corpus_to_file(mycorpus,myfile): fd = open(myfile,"w") input = raw_input("user input") fd.write(input) print "Writing corpus to file: ", myfile print "Goodbye" break Any suggestions? The user info code is : def segment

Export batch variables to text file

泄露秘密 提交于 2021-02-16 20:49:28
问题 I was recently given the advice to export variables from a batch script to a text file using set $>savefile and returning said variables upon another startup using for /f "delims=" %%a in (savefile) do set %%a In implementation, this is not creating a file with the variables, resulting in error in the script, which closes the batch. To remedy the closing, I created a check to display an error message, but still cannot get the script to export variables into a file. Variables ::Variables set

Export batch variables to text file

雨燕双飞 提交于 2021-02-16 20:49:07
问题 I was recently given the advice to export variables from a batch script to a text file using set $>savefile and returning said variables upon another startup using for /f "delims=" %%a in (savefile) do set %%a In implementation, this is not creating a file with the variables, resulting in error in the script, which closes the batch. To remedy the closing, I created a check to display an error message, but still cannot get the script to export variables into a file. Variables ::Variables set

What is the fastest way to record real-time data in python with least memory loss

孤街醉人 提交于 2021-02-11 14:53:12
问题 In every step of a loop I have some data which I want to be saved in the end in my hard disk. One way: list = [] for i in range(1e10): list.append(numpy_array_i) pickle.dump(list, open(self.save_path, "wb"), protocol=4) But I worry: 1_I ran out of memory for because of the list 2_If something crashes all data will be lost. Because of this I have also thought of a way to save data in real time such as: file = make_new_csv_or_xlsx_file() for i in range(1e10): file.write_in_a_new_line(numpy

matplotlib animation save is not obeying blit=True but it seems to work just fine in plt.show()

末鹿安然 提交于 2021-02-11 06:16:10
问题 I'm quite new to Python and am trying to animate text using matplotlib. used several online examples to arrive at the following code: import matplotlib.pyplot as plt import matplotlib.animation as animation fig, ax = plt.subplots() plt.xlabel('Distance') plt.ylabel('Height') plt.title('Object Trajectory \n') plt.legend(loc="upper right", markerscale=4, fontsize=10) plt.grid() text=ax.text(3,1,'Moving Text', ha="left", va="bottom",clip_on=True,rotation=90,fontsize=15) text2=ax.text(0,1,'Moving