openharmony 鸿蒙 changelogs-image

2026-08-25 浏览 (1)

Image Framework Changelog

cl.image.1 Changed the Return Value of mimeType in ImageInfo

Access Level

Public API

Reason for Change

The interface is used for querying image information, and the current return values do not match the actual formats.

  • For raw format images, the actual mimeType should reflect the true format. Since the current decoding of raw format images results in previewImage or JpgFromRaw fields, the incorrect value image/jpeg is returned.
  • For icon format images, the standard name is not used in the return value.

Impact of the Change

This change requires application adaptation.

Actual FormatReturn Value Before ChangeReturn Value After ChangeDecoding SupportEncoding Support
jpegimage/jpegimage/jpegSupportedSupported
iconimage/icoimage/x-iconSupportedNot supported
dngimage/jpegimage/x-adobe-dngSupportedNot supported
cr2image/jpegimage/x-canon-cr2Decoding of preview supportedNot supported
rafimage/jpegimage/x-fuji-rafDecoding of preview supportedNot supported
nefimage/jpegimage/x-nikon-nefDecoding of preview supportedNot supported
nrwimage/jpegimage/x-nikon-nrwDecoding of preview supportedNot supported
orfimage/jpegimage/x-olympus-orfDecoding of preview supportedNot supported
rw2image/jpegimage/x-panasonic-rw2Decoding of preview supportedNot supported
pefimage/jpegimage/x-pentax-pefDecoding of preview supportedNot supported
srwimage/jpegimage/x-samsung-srwDecoding of preview supportedNot supported
arwimage/jpegimage/x-sony-arwDecoding of preview supportedNot supported

Start API Level

API 12

Change Since

OpenHarmony SDK 6.0.0.32

Key API/Component Changes

The return value of the mimeType parameter in the ImageInfo object is changed.

Adaptation Guide

The return value of the image information query interface has changed, but the calling method remains the same.

import { image } from '@kit.ImageKit';
import { BusinessError } from '@kit.BasicServicesKit';

function getImageMimeType(context: Context) {
  // 'test.dng' is only an example. Replace it with the actual one in use. Otherwise, the imageSource instance fails to be created, and subsequent operations cannot be performed.
  const path: string = context.filesDir + "/test.dng";
  const imageSourceApi: image.ImageSource = image.createImageSource(path);
  if (imageSourceApi != undefined) {
    imageSourceApi.getImageInfo().then((imageInfo: image.ImageInfo) => {
      console.info("Succeeded in obtaining the image mimeType information.");
      // No need to change the calling method. Update the condition here to match the new return value for actual raw formats.
      if (imageInfo.mimeType == "image/x-adobe-dng") {
        console.info("Image mimeType is image/x-adobe-dng.");
      }
    }).catch((error: BusinessError) => {
      console.error(`Failed to obtain the image information. code is ${error.code}, message is ${error.message}`);
    })
  }
}

你可能感兴趣的鸿蒙文章

openharmony 鸿蒙 changelogs-externaldevicemanager

openharmony 鸿蒙 changelogs-multimedia

openharmony 鸿蒙 changelogs-startup

openharmony 鸿蒙 changelogs-ability

openharmony 鸿蒙 changelogs-arkts

openharmony 鸿蒙 changelogs-bluetooth

  • 所属分类: 后端技术
  • 本文标签: 软件 鸿蒙
  • 版权声明: 本文链接 https://seaxiang.com/blog/wBW7hh1z