L
L
lolo_to2021-03-01 00:04:13
Django
lolo_to, 2021-03-01 00:04:13

How to change the extension of an image loaded via ajax?

Through ajax I load the image, and the server receives it like this:

@csrf_exempt
def ajax_img_loadDef(request):

    if request.method == 'POST':        

        # получит изображение
        img_load = request.FILES['img_load']

        # заменит изображение с расширением gif на jpg
        # 

        return HttpResponse('success')

Here, and I, as indicated in the comment, need to REPLACE THE IMAGE WITH THE EXPANSION OF GIF TO JPG. Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Antonio Solo, 2021-03-01
@lolo_to

if you just need to change the extension - save it to a file with the extension you need. and all.
and if you need to convert gif to jpg , then you will have to use some kind of graphics library, for example, pillow

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question