# BAD REQUEST at dall-e's createImageEdit function

**URL:** <https://community.openai.com/t/bad-request-at-dall-es-createimageedit-function/53884>\
**Category:** API\
**Created:** [February 9, 2023, 12:58am UTC](https://community.openai.com/t/bad-request-at-dall-es-createimageedit-function/53884 "2023-02-09T00:58:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pirata\_Pooper](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/pirata_pooper/32/27069_2.png) [@Pirata\_Pooper](https://community.openai.com/u/Pirata_Pooper)\
**Post date:** [February 9, 2023, 12:58am UTC](https://community.openai.com/t/bad-request-at-dall-es-createimageedit-function/53884/1 "2023-02-09T00:58:18Z")

</div>

hello, im experimenting dall-e and would like to make edits of images. But for some reason it is returning me a HTTP 400 (bad request), i tried to look for an answer but unfortunately no success. I tried to write it on typescript, but a type error was beeing sent (it was expecting something of a type called “File”), then i wrote it on common js but still get the bad request error.

```auto
import { openai } from '../../core/openai';
import { createReadStream } from 'fs'

const request = await openai.createImageEdit(
      createReadStream("./tmp/variation.png"),
      createReadStream("./tmp/variationR.png"),
      "make this pig have purple wings",
      2,
      "1024x1024",
    );

    const response = request.data.data[0].url;
    console.log(response);

```

```auto
 response: {
    status: 400,
    statusText: 'BAD REQUEST',
    headers: {
      date: 'Thu, 09 Feb 2023 00:45:22 GMT',
      'content-type': 'application/json',
      'content-length': '195',
      connection: 'close',
      'access-control-allow-origin': '*',
      'openai-version': '2020-10-01',
      'openai-organization': 'user-yhzflj4mm49ichozhoqiptco',
      'x-request-id': '3eb2c818eb2b539e24f5986c3ef0045b',
      'openai-processing-ms': '358',
      'strict-transport-security': 'max-age=15724800; includeSubDomains'
    },

```

---

<div class="post-metadata">

**Author:** ![PaulBellow](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/paulbellow/32/597962_2.png) [@PaulBellow](https://community.openai.com/u/PaulBellow)\
**Post date:** [February 9, 2023, 1:35am UTC](https://community.openai.com/t/bad-request-at-dall-es-createimageedit-function/53884/2 "2023-02-09T01:35:28Z")

</div>

![image](https://us1.discourse-cdn.com/openai1/original/3X/2/a/2aeb13013c4036dd55a75c64b803c65fd5f62758.png)

> [@\[SOLVED\] File upload REST API help?](https://community.openai.com/t/solved-file-upload-rest-api-help/32647/6):
>
> This is some “Typescript” code for Dall-E. It uses files as well const response = await openai.createImageEdit( fs.createReadStream(“sunlit\_lounge.png”) as any, fs.createReadStream(“mask.png”) as any, “A sunlit indoor lounge area with a pool containing a flamingo”, 1, “1024x1024” ); The key thing is that they are using a file system ReadStream (but it is an image). I suspect that if you are not using an openai library to help you, you will have to read the file at your end and feed its c…

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [December 15, 2023, 12:37pm UTC](https://community.openai.com/t/bad-request-at-dall-es-createimageedit-function/53884/3 "2023-12-15T12:37:48Z")

</div>

Closed on December 15, 2023, 12:37pm UTC


