09-24-2026 05:28 AM
After migrating an LabVIEW application to
LabVIEW 2026 Q3 64 Bit
Vision Development Module 2026 Q2
Windows 11 Version 25H2 Build 26200.9457
I get the error:
Error -1074396070 occurred at IMAQ Write JPEG2000 File
Possible reason(s):
Unsupported function.
Can somebody please verify if it is a general bug in this version or related to the local installation?
09-28-2026 04:45 AM
@StefanW wrote:
After migrating an LabVIEW application to
LabVIEW 2026 Q3 64 Bit
Vision Development Module 2026 Q2
Can somebody please verify if it is a general bug in this version or related to the local installation?
Yes, can confirm that this VI seems to be buggy, but the oldest one from C:\Program Files\NI\LVAddons\nivisioncommon\1\vi.lib\vision\Files1.llb\IMAQ WriteFile seems to be still functional at least for 8-bit grayscale:
10-01-2026 03:45 AM
Thank you for the hint with the old VI. That helps for one point where we save a U8 image, but unfortunately we also need U16.
Can anyone from NI comment please?
10-01-2026 07:15 AM
@StefanW wrote:
Thank you for the hint with the old VI. That helps for one point where we save a U8 image, but unfortunately we also need U16.
10-01-2026 11:01 AM
In general, it is not that complicated. I created this quick-and-dirty example because I wanted to experiment with OpenCV 5 in Rust and learn a bit more about it. May be this will be helpful for you or someone else.
Source Code:
use opencv::{
core::{CV_16UC1, Mat},
imgcodecs,
prelude::*,
};
use std::{
ffi::CStr,
os::raw::{c_char, c_int},
};
#[unsafe(no_mangle)]
pub extern "C" fn save_jpeg2000(
pixels: *const u16,
stride_pixels: c_int,
width: c_int,
height: c_int,
compression_level: c_int,
path: *const c_char,
) -> c_int {
if pixels.is_null() || path.is_null() || width <= 0 || height <= 0 || stride_pixels < width {
return -1;
}
let result = (|| -> opencv::Result<()> {
let filename = unsafe {
CStr::from_ptr(path).to_str().map_err(|_| opencv::Error::new(0, "Invalid path"))?
};
let width_usize = width as usize;
let height_usize = height as usize;
let stride_usize = stride_pixels as usize;
let mut image = Mat::new_rows_cols_with_default(height, width, CV_16UC1, 0.into())?;
let dst = image.data_typed_mut::<u16>()?;
for y in 0..height_usize {
let src_row =
unsafe { std::slice::from_raw_parts(pixels.add(y * stride_usize), width_usize) };
let dst_row = &mut dst[y * width_usize..(y + 1) * width_usize];
dst_row.copy_from_slice(src_row);
}
let mut params = opencv::core::Vector::<i32>::new();
params.push(imgcodecs::IMWRITE_JPEG2000_COMPRESSION_X1000);
params.push(compression_level.clamp(1, 1000));
let ok = imgcodecs::imwrite(filename, &image, ¶ms)?;
if !ok {
return Err(opencv::Error::new(0, "Failed to save JPEG2000"));
}
Ok(())
})();
match result {
Ok(_) => 0,
Err(_) => -1,
}
}
Links:
Complete source code repository.
LabVIEW example with the compiled DLL.