Skip to content

Commit d6e59ad

Browse files
authored
Merge pull request #17 from Artomatix/FixPythonBindings
Get AIMG python extension compiling
2 parents 916a6d2 + ef1cc54 commit d6e59ad

File tree

5 files changed

+8
-7
lines changed

5 files changed

+8
-7
lines changed

bindings/python/AImg/AImg.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,5 @@ def write(io_or_path, data, fileFormat, profileName, colourProfile, encodeOption
9696
if colourProfile is not None:
9797
colourProfileLen = len(colourProfile)
9898

99-
errCode, imgCapsule = native.write(fileFormat.val, data, stream, width, height, fmt.val, profileName, colourProfile, colourProfileLen, encodeOptionsTuple)
100-
AImgExceptions.checkErrorCode(imgCapsule, errCode)
99+
errCode, imgCapsule = native.write(fileFormat.val, data, stream, width, height, fmt.val, fmt.val, profileName, colourProfile, colourProfileLen, encodeOptionsTuple)
100+
AImgExceptions.checkErrorCode(imgCapsule, errCode)

bindings/python/tests.py

100644100755
File mode changed.

src_c/AIL.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -774,7 +774,7 @@ int32_t AImgConvertFormat(void* src, void* dest, int32_t width, int32_t height,
774774
return AImgErrorCode::AIMG_SUCCESS;
775775
}
776776

777-
bool AImgIsFormatSupported(int32_t fileFormat, int32_t outputFormat)
777+
int32_t AImgIsFormatSupported(int32_t fileFormat, int32_t outputFormat)
778778
{
779779
return loaders[fileFormat]->isFormatSupported(outputFormat);
780780
}
@@ -896,4 +896,4 @@ void AIDestroySimpleMemoryBufferCallbacks(ReadCallback readCallback, WriteCallba
896896

897897
auto data = (SimpleMemoryCallbackData*)callbackData;
898898
delete data;
899-
}
899+
}

src_c/AIL.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extern "C"
156156
EXPORT_FUNC void AIGetFormatDetails(int32_t format, int32_t* numChannels, int32_t* bytesPerChannel, int32_t* floatOrInt);
157157
EXPORT_FUNC int32_t AImgConvertFormat(void* src, void* dest, int32_t width, int32_t height, int32_t inFormat, int32_t outFormat);
158158

159-
EXPORT_FUNC bool AImgIsFormatSupported(int32_t fileFormat, int32_t outputFormat);
159+
EXPORT_FUNC int32_t AImgIsFormatSupported(int32_t fileFormat, int32_t outputFormat);
160160

161161
EXPORT_FUNC int32_t AImgGetWhatFormatWillBeWrittenForData(int32_t fileFormat, int32_t inputFormat, int32_t outputFormat);
162162

src_c/python.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,11 +266,12 @@ static PyObject* pyail_write(PyObject* self, PyObject* args)
266266
PyObject* fileLikeObj;
267267
int width, height;
268268
int inputFormat;
269+
int outputFormat;
269270
const char* profileName;
270271
PyArrayObject* colourProfileObj;
271272
int colourProfileLen;
272273
PyObject* encodingOptionsTuple;
273-
if (!PyArg_ParseTuple(args, "iOOiiisOIO", &fileFormat, &sourceArrayObj, &fileLikeObj, &width, &height, &inputFormat, &profileName, &colourProfileObj, &colourProfileLen, &encodingOptionsTuple))
274+
if (!PyArg_ParseTuple(args, "iOOiiiisOIO", &fileFormat, &sourceArrayObj, &fileLikeObj, &width, &height, &inputFormat, &outputFormat, &profileName, &colourProfileObj, &colourProfileLen, &encodingOptionsTuple))
274275
return NULL;
275276

276277
PyAIL_callback_data* callbackData;
@@ -288,7 +289,7 @@ static PyObject* pyail_write(PyObject* self, PyObject* args)
288289

289290
callbackData->threadState = PyEval_SaveThread();
290291

291-
int err = AImgWriteImage(wImg, PyArray_DATA(sourceArrayObj), width, height, inputFormat, profileName, colourProfile, colourProfileLen, pyail_WriteCallback, pyail_TellCallback, pyail_SeekCallback, callbackData, encodingOptions);
292+
int err = AImgWriteImage(wImg, PyArray_DATA(sourceArrayObj), width, height, inputFormat, outputFormat, profileName, colourProfile, colourProfileLen, pyail_WriteCallback, pyail_TellCallback, pyail_SeekCallback, callbackData, encodingOptions);
292293
PyEval_RestoreThread(callbackData->threadState);
293294

294295
pyail_destroyCallbackData(callbackData);

0 commit comments

Comments
 (0)