# Saving image problem(cp949 problem)

**URL:** <https://forum.opencv.org/t/saving-image-problem-cp949-problem/14126>\
**Category:** Python\
**Tags:** pycharm, imgcodecs\
**Created:** [August 4, 2023, 1:07am UTC](https://forum.opencv.org/t/saving-image-problem-cp949-problem/14126 "2023-08-04T01:07:17Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jurry](https://avatars.discourse-cdn.com/v4/letter/j/2acd7d/32.png) [@jurry](https://forum.opencv.org/u/jurry)\
**Post date:** [August 4, 2023, 1:07am UTC](https://forum.opencv.org/t/saving-image-problem-cp949-problem/14126/1 "2023-08-04T01:07:17Z")

</div>

```auto
filename = 'C:\Users\Jun\Desktop\영상\캡쳐.png'
cv2.imwrite(filename, cv2.cvtColor(currentFrame, cv2.COLOR_RGB2BGR))

```

I wanted to capture image during video… but is didn’t work.  
I found it why it didn’t work, because window’s encoding is Korean filename cp949, but pytcharm’s encoding is UTF-8…

This is solution that I found.

```auto
filename = 'C:\Users\Jun\Desktop\영상\캡쳐.png'
img = cv2.cvtColor(currentFrame, cv2.COLOR_RGB2BGR)
result, encoded_img = cv2.imencode('.png', img)
     if result:
          with open(filename, mode='w+b') as f:
               encoded_img.tofile(f)

```

Is it okay, to use this solution? (encode image and decode image??)  
Doesn’t it make image damaged? Does it make it video slowly? Does it make memory capacity used lot?

if there any solution better than this (like only change filename only encode…) would you teach me ??

Thank you for your help!! :\>

---

<div class="post-metadata">

**Author:** ![matti.vuori](https://avatars.discourse-cdn.com/v4/letter/m/e79b87/32.png) [@matti.vuori](https://forum.opencv.org/u/matti.vuori)\
**Post date:** [August 4, 2023, 8:57pm UTC](https://forum.opencv.org/t/saving-image-problem-cp949-problem/14126/2 "2023-08-04T20:57:57Z")

</div>

Obviously, you can test it, whether it damages the image and how it compares to the original image.

And you can of course time it and see how it petforms.

The extra memory used is practically nothing, considering what else you have loaded and what you do with the image.
