Import images using scripting

I am trying to use that ImageManager.insertImage function with code like this:

from com.inductiveautomation.ignition.gateway import IgnitionGateway
from com.inductiveautomation.ignition.gateway.images import ImageFormat
imageManager = IgnitionGateway.get().getImageManager()
imageManager.insertImageFolder("derp",None)
fImage = open("D:/test/test.png","rb")
bImage = fImage.read()
imageManager.insertImage("test","test desc",ImageFormat.PNG,"derp",bImage,100,100,1976)

When I run it on the gateway, it creates two folders named derp and der with no images inside, and no exceptions in log. What am I doing wrong?

Is this file, path, on the Gateway machine? Does the Ignition service have permission to access that location?

Yes, I did check with logger, and it reads exactly 1976 bytes of image data.

Okay, the problem was in the folder name, it needs to have '/' at the end, otherwise it creates new folder without importing the image itself.