Survey banner
Share your feedback on the Dataiku documentation with this 5 min survey. Thanks! TAKE THE SURVEY

Uploading image files to managed folder

Solved!
Buse
Level 1
Uploading image files to managed folder

Hello,

I need to pull images from a folder, transform it and upload it to another folder using python script.

I pulled and transformed the images but I have trouble saving to destination folder. upload_data takes binary data not image data. Other upload methods requires "local file path"

Anyway other method I can use?

Thank you

0 Kudos
1 Solution
DanDy
Dataiker

You could use some code similar to this sample code:

import dataiku, io
from PIL import Image
import numpy as np
​
a = np.asarray(img)
img1 = Image.fromarray(a,'RGB')

buf=io.BytesIO()
img1.save(buf, format='PNG')

folder_handle = dataiku.Folder("3wglEqHl")
folder_handle.upload_stream("/Monimage7.jpg", buf.getvalue())

View solution in original post

3 Replies
DanDy
Dataiker

You could use some code similar to this sample code:

import dataiku, io
from PIL import Image
import numpy as np
​
a = np.asarray(img)
img1 = Image.fromarray(a,'RGB')

buf=io.BytesIO()
img1.save(buf, format='PNG')

folder_handle = dataiku.Folder("3wglEqHl")
folder_handle.upload_stream("/Monimage7.jpg", buf.getvalue())
Vebo123
Level 1

This is about the uploading image in managed folder but How we can read the image present in the managed folder of Dataiku?

 

0 Kudos

Please start a new thread.

0 Kudos

Labels

?
Labels (2)
A banner prompting to get Dataiku